Jump to content

  • Log In with Google      Sign In   
  • Create Account


In what state is a thread when you create it?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 noatom   Members   -  Reputation: 773

Like
0Likes
Like

Posted 25 May 2014 - 06:52 AM

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)



Sponsor:

#2 rip-off   Moderators   -  Reputation: 7727

Like
3Likes
Like

Posted 25 May 2014 - 09:02 AM

This overview seems to cover your question:

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS