From 75586eec0eadc6e32d3822cd76614e1b9595ad84 Mon Sep 17 00:00:00 2001 From: "Vicente J. Botet Escriba" Date: Thu, 7 Feb 2013 18:43:50 +0000 Subject: [PATCH] Thread: manage #7980 [SVN r82777] --- include/boost/thread/win32/shared_mutex.hpp | 13 ++++++++++++- src/win32/thread.cpp | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/include/boost/thread/win32/shared_mutex.hpp b/include/boost/thread/win32/shared_mutex.hpp index 94269489..4f3ca0e2 100644 --- a/include/boost/thread/win32/shared_mutex.hpp +++ b/include/boost/thread/win32/shared_mutex.hpp @@ -133,7 +133,11 @@ namespace boost void lock_shared() { +#if defined BOOST_THREAD_USES_DATETIME BOOST_VERIFY(timed_lock_shared(::boost::detail::get_system_time_sentinel())); +#else + BOOST_VERIFY(try_lock_shared_until(chrono::steady_clock::now())); +#endif } #if defined BOOST_THREAD_USES_DATETIME @@ -379,14 +383,20 @@ namespace boost void lock() { +#if defined BOOST_THREAD_USES_DATETIME BOOST_VERIFY(timed_lock(::boost::detail::get_system_time_sentinel())); +#else + BOOST_VERIFY(try_lock_until(chrono::steady_clock::now())); +#endif } +#if defined BOOST_THREAD_USES_DATETIME template bool timed_lock(TimeDuration const & relative_time) { return timed_lock(get_system_time()+relative_time); } +#endif bool try_lock() { @@ -414,6 +424,7 @@ namespace boost } +#if defined BOOST_THREAD_USES_DATETIME bool timed_lock(boost::system_time const& wait_until) { for(;;) @@ -492,7 +503,7 @@ namespace boost BOOST_ASSERT(wait_res<2); } } - +#endif #ifdef BOOST_THREAD_USES_CHRONO template bool try_lock_for(const chrono::duration& rel_time) diff --git a/src/win32/thread.cpp b/src/win32/thread.cpp index a50c3b7f..7aa8afce 100644 --- a/src/win32/thread.cpp +++ b/src/win32/thread.cpp @@ -14,7 +14,7 @@ #endif //#define BOOST_THREAD_VERSION 3 -#include +#include #include #include #include