Documentation Home >> Headers >> <thread> Header >> std::thread >> std::thread::join Member Function

Wait for the thread of execution associated with *this to finish.

void join();

Preconditions:

this->joinable() would return true

Effects:

Blocks the current thread until the thread of execution associated with *this has finished.

Postconditions:

this->get_id()==id(). The thread of execution associated with *this prior to the call has finished.

Synchronization:

The completion of the thread of execution associated with *this prior to the call happens-before the call to join() returns.

Throws:

std::system_error if the effects cannot be achieved or this->joinable() would return false.

Header

#include <thread>

See Also