|
Boost Users : |
Subject: Re: [Boost-users] [thread]
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2009-09-10 11:26:33
Alexander Heinrich <alexander.tobias.heinrich_at_[hidden]> writes:
> I want to determine if a given thread is still running or has already
> completed. I thought the joinable() method would provide this information, but
> unfortunately it seems that a thread does not automatically become Not-A-Thread
> after completion.
That is true.
> So what should I do instead if I want to know if a thread is still running?
Set a flag at the end of the thread function. Then, in other code, you
can check the flag. If the flag is set then the thread is done.
Anthony
-- Author of C++ Concurrency in Action | http://www.manning.com/williams just::thread C++0x thread library | http://www.stdthread.co.uk Just Software Solutions Ltd | http://www.justsoftwaresolutions.co.uk 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976
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