Subject: [Boost-bugs] [Boost C++ Libraries] #9787: Small duration value passed down to basic_timed_mutex::try_lock_until and condition_variable::wait_until can cause infinite or near infinite wait for win32
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-03-17 22:48:25
#9787: Small duration value passed down to basic_timed_mutex::try_lock_until and
condition_variable::wait_until can cause infinite or near infinite wait for
win32
-------------------------------------------------+-------------------------
Reporter: Bryan Laird <bryan_laird@â¦> | Owner: anthonyw
Type: Bugs | Status: new
Milestone: To Be Determined | Component: thread
Version: Boost 1.53.0 | Severity: Problem
Keywords: WaitForSingleObject timed_mutex |
try_lock_until wait_until |
-------------------------------------------------+-------------------------
Creating a unique_lock using a timed_mutex which is passed a small
chrono::milliseconds duration value (10 milliseconds in our case) can
cause a very large value to be passed to WaitForSingleObject for the
dwMilliseconds parameter. The code path creates an initial
chrono::time_point where the duration value is added to the current time.
Once it gets to try_lock_until it calculates a new rel_time duration to
feed to WaitForSingleObject. If the small duration has elapsed due to
thread switching then the subtraction results in a very large positive
value to be passed to WaitForSingleObject.
Similarly, if we calculate our own boost::chrono::system_clock::time_point
and pass it to boost::condition_variable::wait_until and the time_point
has passed then the subtraction to compute a relative time value can
result in a very large positive value. Another possibility is if the
caller inadvertently passes an elapsed time_point to
condition_variable::wait_until.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9787> 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