So after you create the thread you can either join it, and wait for it to complete, or detach it, and let it run on its own. But what happens when you do neither? What is the initial state in which a thread gets created? (I'm using the thread feature in c++11)
In what state is a thread when you create it?
Moderators - Reputation: 10546
Posted 25 May 2014 - 09:02 AM
An initialized thread object represents an active thread of execution; Such a thread object is joinable, and has a unique thread id.
A default-constructed (non-initialized) thread object is not joinable, and its thread id is common for all non-joinable threads.
A joinable thread becomes not joinable if moved from, or if either join or detach are called on them.