Re: [Boost-bugs] [Boost C++ Libraries] #9654: try_join_for(0) returns false when thread has exited

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #9654: try_join_for(0) returns false when thread has exited
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-02-16 09:45:12


#9654: try_join_for(0) returns false when thread has exited
-------------------------------+------------------------
  Reporter: ernest.galbrun@… | Owner: anthonyw
      Type: Bugs | Status: closed
 Milestone: | Component: thread
   Version: Boost 1.55.0 | Severity: Regression
Resolution: duplicate | Keywords:
-------------------------------+------------------------
Changes (by viboes):

 * status: new => closed
 * resolution: => duplicate
 * milestone: To Be Determined =>

Comment:

 Replying to [comment:3 ernest.galbrun@…]:
> Hi viboes, thanks for your reply I had not seen the previous issue.
>
> The patch works fine, thank you.
>
> I think the documentation should be more explicit wether this is allowed
 or not, since this is the prefered way of checking if a thread has
 finished when searching on stackoverflow:
 http://stackoverflow.com/questions/1667420/how-can-i-tell-reliably-if-a
 -boost-thread-has-exited-its-run-method
>
> Maybe we should change the SO answer, what is your stance about this
 issue ? What is the ''correct'' way of checking whether a thread has
 finished?

 The answer of MSalters is the correct one.


 ''You fundamentally can't do this. The reason is that the two possible
 answers are "Yes" and "Not when I last looked but perhaps now". There is
 no reliable way to determine that a thread is still'' inside its run
 method, even if there was a reliable way to determine the opposite.


 You can just join the thread if not already detached.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9654#comment:4>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:15 UTC