|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r78239 - trunk/boost/thread/pthread
From: vicente.botet_at_[hidden]
Date: 2012-04-28 08:24:08
Author: viboes
Date: 2012-04-28 08:24:08 EDT (Sat, 28 Apr 2012)
New Revision: 78239
URL: http://svn.boost.org/trac/boost/changeset/78239
Log:
Thread: Add a workaround for the bug identified in ticket 6130 by adding some microseconds to the time to wait
Text files modified:
trunk/boost/thread/pthread/condition_variable_fwd.hpp | 20 ++++++++------------
1 files changed, 8 insertions(+), 12 deletions(-)
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-04-28 08:24:08 EDT (Sat, 28 Apr 2012)
@@ -18,7 +18,8 @@
#include <boost/chrono/system_clocks.hpp>
#include <boost/chrono/ceil.hpp>
#endif
-
+#include <boost/thread/detail/delete.hpp>
+#include <boost/date_time/posix_time/posix_time_duration.hpp>
#include <boost/config/abi_prefix.hpp>
namespace boost
@@ -30,17 +31,6 @@
pthread_mutex_t internal_mutex;
pthread_cond_t cond;
-
-//#ifndef BOOST_NO_DELETED_FUNCTIONS
-// public:
-// condition_variable(condition_variable const&) = delete;
-// condition_variable& operator=(condition_variable const&) = delete;
-//#else // BOOST_NO_DELETED_FUNCTIONS
-// private:
-// condition_variable(condition_variable const&);
-// condition_variable& operator=(condition_variable const&);
-//#endif // BOOST_NO_DELETED_FUNCTIONS
-
public:
BOOST_THREAD_NO_COPYABLE(condition_variable)
condition_variable()
@@ -75,12 +65,18 @@
while(!pred()) wait(m);
}
+
inline bool timed_wait(
unique_lock<mutex>& m,
boost::system_time const& wait_until)
{
+#if defined BOOST_THREAD_WAIT_BUG
+ struct timespec const timeout=detail::get_timespec(wait_until+boost::posix_time::microseconds(1000));
+ return do_timed_wait(m, timeout);
+#else
struct timespec const timeout=detail::get_timespec(wait_until);
return do_timed_wait(m, timeout);
+#endif
}
bool timed_wait(
unique_lock<mutex>& m,
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