
----- Original Message ----- From: "Anthony Williams" <anthony.ajw@gmail.com> To: <boost@lists.boost.org> Sent: Monday, November 10, 2008 12:57 PM Subject: Re: [boost] [thread] condition::try_wait() and thread::try_join()?
"vicente.botet" <vicente.botet@wanadoo.fr> writes:
I'm sure there you have a good rationale to don't have condition::try_wait() or thread::try_join() functions. Could you share with us? Can these functions be emulated? If yes, why not adding them?
What would try_wait do? A condition variable notify only applies to currently waiting threads. Since "try_wait" would be instantaneous, it would never be notified since you would never get a concurrent call to notify. You have timed_wait though, so you could try it out with a timeout of zero if you're so inclined.
Ok, I see.
try_join is more sensible, and it might be worth adding it.
I'm more interested on the try_join. Does the following do a try_join? boost::thread th(fct); th.timed_join(0); Is this the more efficient way? Thanks, Vicente