Waiting for C++ 11 thread to actually start

c++, c++11, multithreading

Solution

The language definition requires that the new thread has started before the constructor returns. Formally, that's [thread.thread.constr] /5: "The completion of the invocation of the constructor synchronizes with the beginning of the invocation of the copy of f."

Problem

How to wait until C++ 11 thread is started after it was created? It doesn't seem to have any method for that, unlike some other threading libraries (like Qt) that offer a special method to check if thread is running or not.

Original source

Related problems