[Boost-bugs] [Boost C++ Libraries] #9845: Nondeterministic behavior of boost::thread::try_join_for()

Subject: [Boost-bugs] [Boost C++ Libraries] #9845: Nondeterministic behavior of boost::thread::try_join_for()
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-04-07 10:46:56


#9845: Nondeterministic behavior of boost::thread::try_join_for()
------------------------------+----------------------
 Reporter: sunheretic13@… | Owner: anthonyw
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: thread
  Version: Boost 1.54.0 | Severity: Problem
 Keywords: |
------------------------------+----------------------
 Hello

 I want to say that this function 'boost::thread::try_join_for()' works
 very strange. Which negates the possibility of its use in certain
 situations.

 I want to control - the thread executed or not? Just check , I do not want
 to wait for minutes or hours waiting for its completion.

 For me, it would be logical to pass as a parameter to '0' in function
 boost::thread::try_join_for(), but it turned out that the result of the
 wrong.

 As it turned out function checks timeout check and only then checks the
 state of the thread.

 Some people advise to pass as a parameter small delay. But I say - this is
 not a solution because :

 1. There is no official document describing the magnitude of the delay.
 How it should be - one second? 1 millisecond? 1 microsecond? 1 nanosecond?
 2. The current implementation of the function boost::thread::try_join_for
 ('small delay') will give a different behavior depending on your
 computer's performance, CPU utilization, and moon phases. Which is clearly
 not fit for industrial programming.
 3. Applying pure WinAPI - WaitForSingleObject(hThread, 0) can achieve the
 correct result. But it WINAPI, not boost.

 I think that the function should be rewritten to resolve the ambiguity of
 her behavior.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9845>
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