Q:

C++11 threads: How to start a thread and, separately, check for its completion?

In C++11 the call
my_thread.join();

runs the thread and waits for its completion. And I need to, first, run the thread and, later, to wait for its completion. The way it's done, say, in UNIX systems:
pthread_create(...)

runs a thread, and
pthread_join(...)

waits for completion. Is this possible with C++11?

A:

std::thread::join() does not make thread run. When std::thread object constructs with function-object parameters, The thread runs.
For example:
std::thread thrd1(doSomething); // Thread starts
// Some codes...
thrd1.join(); // Wait for thread exit
std::thread thrd2; // default constructor
thrd2 = std::thread(doSomething);
// blablabla...
thrd2.join();

