views:

82

answers:

2

What does boost::thread do if it fails to create the thread?

The winAPI returns a NULL (I guess posix does something similar) but as thread is an object how do I test to see if the thread was created?

+10  A: 

According to the API, it throws a boost::thread_resource_error if the thread creation fails.

I guess you cannot create an invalid boost::thread object: if something goes wrong, the constructor throws thus preventing the object creation.

ereOn
Thanks, I did look in the documentation, don't know how I missed that
Patrick
+7  A: 

Throws: boost::thread_resource_error if an error occurs

Ken Bloom
Thanks, given the answer to ereOn as he answered moments before you
Patrick