|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r82299 - trunk/boost/thread/pthread
From: vicente.botet_at_[hidden]
Date: 2012-12-31 07:42:32
Author: viboes
Date: 2012-12-31 07:42:32 EST (Mon, 31 Dec 2012)
New Revision: 82299
URL: http://svn.boost.org/trac/boost/changeset/82299
Log:
Thread: fix issue with wait_for predicate
Text files modified:
trunk/boost/thread/pthread/condition_variable.hpp | 14 ++++++++------
trunk/boost/thread/pthread/condition_variable_fwd.hpp | 14 ++++++++------
2 files changed, 16 insertions(+), 12 deletions(-)
Modified: trunk/boost/thread/pthread/condition_variable.hpp
==============================================================================
--- trunk/boost/thread/pthread/condition_variable.hpp (original)
+++ trunk/boost/thread/pthread/condition_variable.hpp 2012-12-31 07:42:32 EST (Mon, 31 Dec 2012)
@@ -307,12 +307,14 @@
const chrono::duration<Rep, Period>& d,
Predicate pred)
{
- while (!pred())
- {
- if (wait_for(lock, d) == cv_status::timeout)
- return pred();
- }
- return true;
+ return wait_until(lock, chrono::steady_clock::now() + d, boost::move(pred));
+
+// while (!pred())
+// {
+// if (wait_for(lock, d) == cv_status::timeout)
+// return pred();
+// }
+// return true;
}
template <class lock_type>
Modified: trunk/boost/thread/pthread/condition_variable_fwd.hpp
==============================================================================
--- trunk/boost/thread/pthread/condition_variable_fwd.hpp (original)
+++ trunk/boost/thread/pthread/condition_variable_fwd.hpp 2012-12-31 07:42:32 EST (Mon, 31 Dec 2012)
@@ -221,12 +221,14 @@
const chrono::duration<Rep, Period>& d,
Predicate pred)
{
- while (!pred())
- {
- if (wait_for(lock, d) == cv_status::timeout)
- return pred();
- }
- return true;
+ return wait_until(lock, chrono::steady_clock::now() + d, boost::move(pred));
+
+// while (!pred())
+// {
+// if (wait_for(lock, d) == cv_status::timeout)
+// return pred();
+// }
+// return true;
}
#endif
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