Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 663
Patrick Avatar asked Jun 23 '10 14:06

Patrick


2 Answers

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.

like image 83
ereOn Avatar answered Nov 14 '22 20:11

ereOn


Throws: boost::thread_resource_error if an error occurs

like image 44
Ken Bloom Avatar answered Nov 14 '22 22:11

Ken Bloom