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

Detach the thread of execution associated with *this to finish.

void detach();

Preconditions:

this->joinable() would return true

Effects:

Detaches the thread of execution associated with *this.

Postconditions:

this->get_id()==id(). The thread of execution associated with *this prior to the call is detached, and no longer has an associated std::thread object.

Throws:

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

Header

#include <thread>

See Also