|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r83652 - trunk/boost/thread/detail
From: vicente.botet_at_[hidden]
Date: 2013-03-30 14:28:30
Author: viboes
Date: 2013-03-30 14:28:29 EDT (Sat, 30 Mar 2013)
New Revision: 83652
URL: http://svn.boost.org/trac/boost/changeset/83652
Log:
Thread: check for time_points in the past on try_join_until to take care of #8323.
Text files modified:
trunk/boost/thread/detail/thread.hpp | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
Modified: trunk/boost/thread/detail/thread.hpp
==============================================================================
--- trunk/boost/thread/detail/thread.hpp (original)
+++ trunk/boost/thread/detail/thread.hpp 2013-03-30 14:28:29 EDT (Sat, 30 Mar 2013)
@@ -476,8 +476,13 @@
{
using namespace chrono;
system_clock::time_point s_now = system_clock::now();
- typename Clock::time_point c_now = Clock::now();
- return try_join_until(s_now + ceil<nanoseconds>(t - c_now));
+ bool joined= false;
+ do {
+ typename Clock::duration d = ceil<nanoseconds>(t-Clock::now());
+ if (d <= Clock::duration::zero()) return false; // in case the Clock::time_point t is already reached
+ joined = try_join_until(s_now + d);
+ } while (! joined);
+ return true;
}
template <class Duration>
bool try_join_until(const chrono::time_point<chrono::system_clock, Duration>& t)
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk