summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2014-10-19 20:22:58 (GMT)
committerTobias Markmann <tm@ayena.de>2014-10-20 13:49:33 (GMT)
commit6b22dfcf59474dd016a0355a3102a1dd3692d92c (patch)
tree2b1fd33be433a91e81fee84fdc2bf1b52575d934 /3rdParty/Boost/src/boost/thread/v2/thread.hpp
parent38b0cb785fea8eae5e48fae56440695fdfd10ee1 (diff)
downloadswift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.zip
swift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.tar.bz2
Update Boost in 3rdParty to version 1.56.0.
This updates Boost in our 3rdParty directory to version 1.56.0. Updated our update.sh script to stop on error. Changed error reporting in SwiftTools/CrashReporter.cpp to SWIFT_LOG due to missing include of <iostream> with newer Boost. Change-Id: I4b35c77de951333979a524097f35f5f83d325edc
Diffstat (limited to '3rdParty/Boost/src/boost/thread/v2/thread.hpp')
-rw-r--r--3rdParty/Boost/src/boost/thread/v2/thread.hpp96
1 files changed, 91 insertions, 5 deletions
diff --git a/3rdParty/Boost/src/boost/thread/v2/thread.hpp b/3rdParty/Boost/src/boost/thread/v2/thread.hpp
index d686c5f..181661a 100644
--- a/3rdParty/Boost/src/boost/thread/v2/thread.hpp
+++ b/3rdParty/Boost/src/boost/thread/v2/thread.hpp
@@ -9,26 +9,77 @@
#include <boost/thread/detail/config.hpp>
#ifdef BOOST_THREAD_USES_CHRONO
#include <boost/chrono/system_clocks.hpp>
+#include <boost/chrono/ceil.hpp>
#endif
#include <boost/thread/condition_variable.hpp>
-#include <boost/thread/locks.hpp>
+#include <boost/thread/lock_types.hpp>
namespace boost
{
namespace this_thread
{
-
+ namespace no_interruption_point
+ {
#ifdef BOOST_THREAD_USES_CHRONO
+ template <class Clock, class Duration>
+ void sleep_until(const chrono::time_point<Clock, Duration>& t)
+ {
+ using namespace chrono;
+ mutex mut;
+ condition_variable cv;
+ unique_lock<mutex> lk(mut);
+ while (Clock::now() < t)
+ cv.wait_until(lk, t);
+ }
+
+#ifdef BOOST_THREAD_SLEEP_FOR_IS_STEADY
+
template <class Rep, class Period>
void sleep_for(const chrono::duration<Rep, Period>& d)
{
using namespace chrono;
- nanoseconds ns = duration_cast<nanoseconds> (d);
- if (ns < d) ++ns;
- sleep_for(ns);
+ if (d > duration<Rep, Period>::zero())
+ {
+ duration<long double> Max = nanoseconds::max BOOST_PREVENT_MACRO_SUBSTITUTION ();
+ nanoseconds ns;
+ if (d < Max)
+ {
+ ns = duration_cast<nanoseconds>(d);
+ if (ns < d)
+ ++ns;
+ }
+ else
+ ns = nanoseconds:: max BOOST_PREVENT_MACRO_SUBSTITUTION ();
+ sleep_for(ns);
+ }
}
+ template <class Duration>
+ inline BOOST_SYMBOL_VISIBLE
+ void sleep_until(const chrono::time_point<chrono::steady_clock, Duration>& t)
+ {
+ using namespace chrono;
+ sleep_for(t - steady_clock::now());
+ }
+#else
+ template <class Rep, class Period>
+ void sleep_for(const chrono::duration<Rep, Period>& d)
+ {
+ using namespace chrono;
+ if (d > duration<Rep, Period>::zero())
+ {
+ steady_clock::time_point c_timeout = steady_clock::now() + ceil<nanoseconds>(d);
+ sleep_until(c_timeout);
+ }
+ }
+
+#endif
+
+#endif
+ }
+#ifdef BOOST_THREAD_USES_CHRONO
+
template <class Clock, class Duration>
void sleep_until(const chrono::time_point<Clock, Duration>& t)
{
@@ -40,6 +91,28 @@ namespace boost
cv.wait_until(lk, t);
}
+#ifdef BOOST_THREAD_SLEEP_FOR_IS_STEADY
+
+ template <class Rep, class Period>
+ void sleep_for(const chrono::duration<Rep, Period>& d)
+ {
+ using namespace chrono;
+ if (d > duration<Rep, Period>::zero())
+ {
+ duration<long double> Max = nanoseconds::max BOOST_PREVENT_MACRO_SUBSTITUTION ();
+ nanoseconds ns;
+ if (d < Max)
+ {
+ ns = duration_cast<nanoseconds>(d);
+ if (ns < d)
+ ++ns;
+ }
+ else
+ ns = nanoseconds:: max BOOST_PREVENT_MACRO_SUBSTITUTION ();
+ sleep_for(ns);
+ }
+ }
+
template <class Duration>
inline BOOST_SYMBOL_VISIBLE
void sleep_until(const chrono::time_point<chrono::steady_clock, Duration>& t)
@@ -47,6 +120,19 @@ namespace boost
using namespace chrono;
sleep_for(t - steady_clock::now());
}
+#else
+ template <class Rep, class Period>
+ void sleep_for(const chrono::duration<Rep, Period>& d)
+ {
+ using namespace chrono;
+ if (d > duration<Rep, Period>::zero())
+ {
+ steady_clock::time_point c_timeout = steady_clock::now() + ceil<nanoseconds>(d);
+ sleep_until(c_timeout);
+ }
+ }
+
+#endif
#endif
}