|
Boost Users : |
Subject: Re: [Boost-users] [threads] How to test for running thread
From: Koen Vermeer (koen_at_[hidden])
Date: 2008-10-15 11:57:41
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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net