summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2012-12-23 13:16:26 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-12-23 14:43:26 (GMT)
commit491ddd570a752cf9bda85933bed0c6942e39b1f9 (patch)
tree10c25c1be8cc08d0497df1dccd56a10fbb30beee /3rdParty/Boost/src/boost/thread/v2
parentda7d7a0ca71b80281aa9ff2526290b61ccb0cc60 (diff)
downloadswift-491ddd570a752cf9bda85933bed0c6942e39b1f9.zip
swift-491ddd570a752cf9bda85933bed0c6942e39b1f9.tar.bz2
Update Boost to 1.52.0.
Change-Id: I1e56bea2600bf2ed9c5b3aba8c4f9d2a0f350e77
Diffstat (limited to '3rdParty/Boost/src/boost/thread/v2')
-rw-r--r--3rdParty/Boost/src/boost/thread/v2/thread.hpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/3rdParty/Boost/src/boost/thread/v2/thread.hpp b/3rdParty/Boost/src/boost/thread/v2/thread.hpp
new file mode 100644
index 0000000..d686c5f
--- /dev/null
+++ b/3rdParty/Boost/src/boost/thread/v2/thread.hpp
@@ -0,0 +1,56 @@
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// (C) Copyright 2011 Vicente J. Botet Escriba
+
+#ifndef BOOST_THREAD_V2_THREAD_HPP
+#define BOOST_THREAD_V2_THREAD_HPP
+
+#include <boost/thread/detail/config.hpp>
+#ifdef BOOST_THREAD_USES_CHRONO
+#include <boost/chrono/system_clocks.hpp>
+#endif
+#include <boost/thread/condition_variable.hpp>
+#include <boost/thread/locks.hpp>
+
+namespace boost
+{
+ namespace this_thread
+ {
+
+#ifdef BOOST_THREAD_USES_CHRONO
+
+ 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);
+ }
+
+ 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);
+ }
+
+ 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());
+ }
+
+#endif
+ }
+}
+
+
+#endif