On Wed, 2008-10-15 at 16:16 +0100, Bill Somerville wrote:
I understand, I did wonder if you wanted an asynchronous notification.
A thread can be in a zombie state where it has completed but has not been joined, thread::timed_join() will return true when called on a zombie thread even if the thread was not running before the call.
I would go with the timed_join() with a short timeout. Threads wait around for a join holding their final exit status so there is no race condition that I am aware of, thread termination and joining is deterministic.
Ah, I see. So, that means that, as long as the thread isn't joined or detached, the thread is still 'a thread of execution', to put it wording similar to the timed_join() documentation? And only after joining or detaching, the thread object represents Not-a-Threat (which you could check for by comparing it with boost::thread::id()). Thanks for clearing things up! Best, Koen