|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81279 - in trunk: boost/thread boost/thread/detail boost/thread/win32 libs/thread/doc libs/thread/example libs/thread/src/pthread libs/thread/src/win32 libs/thread/test libs/thread/test/threads/container
From: vicente.botet_at_[hidden]
Date: 2012-11-10 05:25:39
Author: viboes
Date: 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
New Revision: 81279
URL: http://svn.boost.org/trac/boost/changeset/81279
Log:
Thread: deprecate nested scoped locks and DateTime based timed fuctions
Added:
trunk/libs/thread/test/test_7665.cpp (contents, props changed)
Text files modified:
trunk/boost/thread/barrier.hpp | 3
trunk/boost/thread/detail/config.hpp | 19 ++
trunk/boost/thread/detail/thread.hpp | 63 +++++----
trunk/boost/thread/externally_locked.hpp | 67 ++--------
trunk/boost/thread/future.hpp | 4
trunk/boost/thread/scoped_thread.hpp | 5
trunk/boost/thread/strict_lock.hpp | 10
trunk/boost/thread/win32/basic_recursive_mutex.hpp | 4
trunk/boost/thread/win32/basic_timed_mutex.hpp | 6
trunk/boost/thread/win32/condition_variable.hpp | 7
trunk/boost/thread/win32/recursive_mutex.hpp | 1
trunk/boost/thread/win32/shared_mutex.hpp | 3
trunk/boost/thread/xtime.hpp | 3
trunk/libs/thread/doc/changes.qbk | 40 +++--
trunk/libs/thread/doc/configuration.qbk | 11 +
trunk/libs/thread/doc/future_ref.qbk | 256 +++++++++++++++++++++++++++++++--------
trunk/libs/thread/example/condition.cpp | 10
trunk/libs/thread/example/make_future.cpp | 2
trunk/libs/thread/example/monitor.cpp | 10
trunk/libs/thread/example/mutex.cpp | 6
trunk/libs/thread/example/recursive_mutex.cpp | 6
trunk/libs/thread/example/scoped_thread.cpp | 14 ++
trunk/libs/thread/example/starvephil.cpp | 24 +-
trunk/libs/thread/example/tennis.cpp | 6
trunk/libs/thread/example/thread_group.cpp | 2
trunk/libs/thread/src/pthread/thread.cpp | 9 +
trunk/libs/thread/src/pthread/timeconv.inl | 21 +++
trunk/libs/thread/src/win32/thread.cpp | 13 -
trunk/libs/thread/test/Jamfile.v2 | 3
trunk/libs/thread/test/condition_test_common.hpp | 24 +-
trunk/libs/thread/test/shared_mutex_locking_thread.hpp | 40 +++---
trunk/libs/thread/test/test_2309.cpp | 6
trunk/libs/thread/test/test_3628.cpp | 4
trunk/libs/thread/test/test_6130.cpp | 2
trunk/libs/thread/test/test_6174.cpp | 1
trunk/libs/thread/test/test_7571.cpp | 2
trunk/libs/thread/test/test_barrier.cpp | 2
trunk/libs/thread/test/test_condition.cpp | 6
trunk/libs/thread/test/test_condition_notify_all.cpp | 14 +-
trunk/libs/thread/test/test_condition_notify_one.cpp | 14 +-
trunk/libs/thread/test/test_condition_timed_wait_times_out.cpp | 16 +-
trunk/libs/thread/test/test_generic_locks.cpp | 12
trunk/libs/thread/test/test_lock_concept.cpp | 9
trunk/libs/thread/test/test_mutex.cpp | 3
trunk/libs/thread/test/test_once.cpp | 12
trunk/libs/thread/test/test_shared_mutex.cpp | 24 +-
trunk/libs/thread/test/test_shared_mutex_part_2.cpp | 22 +-
trunk/libs/thread/test/test_shared_mutex_timed_locks.cpp | 12
trunk/libs/thread/test/test_shared_mutex_timed_locks_chrono.cpp | 12
trunk/libs/thread/test/test_thread.cpp | 12
trunk/libs/thread/test/test_thread_launching.cpp | 3
trunk/libs/thread/test/test_thread_mf.cpp | 1
trunk/libs/thread/test/test_tss.cpp | 6
trunk/libs/thread/test/test_xtime.cpp | 2
trunk/libs/thread/test/threads/container/thread_ptr_list_pass.cpp | 2
trunk/libs/thread/test/threads/container/thread_vector_pass.cpp | 2
trunk/libs/thread/test/util.inl | 6
57 files changed, 554 insertions(+), 345 deletions(-)
Modified: trunk/boost/thread/barrier.hpp
==============================================================================
--- trunk/boost/thread/barrier.hpp (original)
+++ trunk/boost/thread/barrier.hpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -12,6 +12,7 @@
#include <boost/throw_exception.hpp>
#include <boost/thread/mutex.hpp>
+#include <boost/thread/lock_types.hpp>
#include <boost/thread/condition_variable.hpp>
#include <string>
#include <stdexcept>
@@ -33,7 +34,7 @@
bool wait()
{
- boost::mutex::scoped_lock lock(m_mutex);
+ boost::unique_lock<boost::mutex> lock(m_mutex);
unsigned int gen = m_generation;
if (--m_count == 0)
Modified: trunk/boost/thread/detail/config.hpp
==============================================================================
--- trunk/boost/thread/detail/config.hpp (original)
+++ trunk/boost/thread/detail/config.hpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -25,6 +25,21 @@
#endif
#endif
+#if defined BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED
+#define BOOST_THREAD_ASSERT_PRECONDITION(EXPR, EX) \
+ if (EXPR) {} else boost::throw_exception(EX)
+#define BOOST_THREAD_VERIFY_PRECONDITION(EXPR, EX) \
+ if (EXPR) {} else boost::throw_exception(EX)
+#define BOOST_THREAD_THROW_ELSE_RETURN(EX, RET) \
+ boost::throw_exception(EX)
+#else
+#define BOOST_THREAD_ASSERT_PRECONDITION(EXPR, EX)
+#define BOOST_THREAD_VERIFY_PRECONDITION(EXPR, EX) \
+ (void)(EXPR)
+#define BOOST_THREAD_THROW_ELSE_RETURN(EX, RET) \
+ return (RET)
+#endif
+
// This compiler doesn't support Boost.Chrono
#if defined __IBMCPP__ && (__IBMCPP__ < 1100) && ! defined BOOST_THREAD_DONT_USE_CHRONO
#define BOOST_THREAD_DONT_USE_CHRONO
@@ -54,9 +69,9 @@
#endif
-// Default version is 2
+// Default version is 3
#if !defined BOOST_THREAD_VERSION
-#define BOOST_THREAD_VERSION 2
+#define BOOST_THREAD_VERSION 4
#else
#if BOOST_THREAD_VERSION!=2 && BOOST_THREAD_VERSION!=3 && BOOST_THREAD_VERSION!=4
#error "BOOST_THREAD_VERSION must be 2, 3 or 4"
Modified: trunk/boost/thread/detail/thread.hpp
==============================================================================
--- trunk/boost/thread/detail/thread.hpp (original)
+++ trunk/boost/thread/detail/thread.hpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -14,7 +14,9 @@
#endif
#include <boost/thread/detail/move.hpp>
#include <boost/thread/mutex.hpp>
+#if defined BOOST_THREAD_USES_DATETIME
#include <boost/thread/xtime.hpp>
+#endif
#include <boost/thread/detail/thread_heap_alloc.hpp>
#include <boost/thread/detail/make_tuple_indices.hpp>
#include <boost/thread/detail/invoke.hpp>
@@ -257,7 +259,7 @@
class F
>
explicit thread(BOOST_THREAD_RV_REF(F) f
- , typename disable_if<is_same<typename decay<F>::type, thread>, dummy* >::type=0
+ //, typename disable_if<is_same<typename decay<F>::type, thread>, dummy* >::type=0
):
thread_info(make_thread_info(thread_detail::decay_copy(boost::forward<F>(f))))
{
@@ -266,7 +268,7 @@
template <
class F
>
- thread(attributes& attrs, BOOST_THREAD_RV_REF(F) f):
+ thread(attributes const& attrs, BOOST_THREAD_RV_REF(F) f):
thread_info(make_thread_info(thread_detail::decay_copy(boost::forward<F>(f))))
{
start_thread(attrs);
@@ -281,7 +283,7 @@
start_thread();
}
template <class F>
- thread(attributes& attrs, F f):
+ thread(attributes const& attrs, F f):
thread_info(make_thread_info(f))
{
start_thread(attrs);
@@ -290,15 +292,18 @@
template <class F>
explicit thread(F f
, typename disable_if_c<
- boost::is_convertible<F&,BOOST_THREAD_RV_REF(F)>::value || is_same<typename decay<F>::type, thread>::value,
- dummy* >::type=0):
+ boost::is_convertible<F&,BOOST_THREAD_RV_REF(F)>::value
+ //|| is_same<typename decay<F>::type, thread>::value
+ , dummy* >::type=0
+ ):
thread_info(make_thread_info(f))
{
start_thread();
}
template <class F>
- thread(attributes& attrs, F f
- , typename disable_if<boost::is_convertible<F&,BOOST_THREAD_RV_REF(F) >, dummy* >::type=0):
+ thread(attributes const& attrs, F f
+ , typename disable_if<boost::is_convertible<F&,BOOST_THREAD_RV_REF(F) >, dummy* >::type=0
+ ):
thread_info(make_thread_info(f))
{
start_thread(attrs);
@@ -318,7 +323,7 @@
}
template <class F>
- thread(attributes& attrs, BOOST_THREAD_RV_REF(F) f):
+ thread(attributes const& attrs, BOOST_THREAD_RV_REF(F) f):
#ifdef BOOST_THREAD_USES_MOVE
thread_info(make_thread_info(boost::move<F>(f))) // todo : Add forward
#else
@@ -366,7 +371,17 @@
{
start_thread();
}
+ template <class F, class Arg, class ...Args>
+ thread(attributes const& attrs, F&& f, Arg&& arg, Args&&... args) :
+ thread_info(make_thread_info(
+ thread_detail::decay_copy(boost::forward<F>(f)),
+ thread_detail::decay_copy(boost::forward<Arg>(arg)),
+ thread_detail::decay_copy(boost::forward<Args>(args))...)
+ )
+ {
+ start_thread(attrs);
+ }
#else
template <class F,class A1>
thread(F f,A1 a1,typename disable_if<boost::is_convertible<F&,thread_attributes >, dummy* >::type=0):
@@ -730,16 +745,12 @@
}
#endif
void thread::join() {
- if (this_thread::get_id() == get_id())
- {
- boost::throw_exception(thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself"));
- }
- if (!join_noexcept())
- {
-#ifdef BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED
- boost::throw_exception(thread_resource_error(system::errc::invalid_argument, "boost thread: thread not joinable"));
-#endif
- }
+ BOOST_THREAD_ASSERT_PRECONDITION( this_thread::get_id() != get_id(),
+ thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself")
+ );
+ BOOST_THREAD_VERIFY_PRECONDITION( join_noexcept(),
+ thread_resource_error(system::errc::invalid_argument, "boost thread: thread not joinable")
+ );
}
#ifdef BOOST_THREAD_PLATFORM_PTHREAD
@@ -748,10 +759,9 @@
bool thread::do_try_join_until(uintmax_t timeout)
#endif
{
- if (this_thread::get_id() == get_id())
- {
- boost::throw_exception(thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself"));
- }
+ BOOST_THREAD_ASSERT_PRECONDITION( this_thread::get_id() != get_id(),
+ thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself")
+ );
bool res;
if (do_try_join_until_noexcept(timeout, res))
{
@@ -759,11 +769,10 @@
}
else
{
-#ifdef BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED
- boost::throw_exception(thread_resource_error(system::errc::invalid_argument, "boost thread: thread not joinable"));
-#else
- return false;
-#endif
+ BOOST_THREAD_THROW_ELSE_RETURN(
+ thread_resource_error(system::errc::invalid_argument, "boost thread: thread not joinable"),
+ false
+ );
}
}
Modified: trunk/boost/thread/externally_locked.hpp
==============================================================================
--- trunk/boost/thread/externally_locked.hpp (original)
+++ trunk/boost/thread/externally_locked.hpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -87,19 +87,13 @@
*/
T& get(strict_lock<mutex_type>& lk)
{
-
-#ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME /*< define BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME if you don't want to check lk check the same mtx >*/
- if (!lk.owns_lock(mtx_)) throw lock_error(); /*< run time check throw if not locks the same >*/
-#endif
+ BOOST_THREAD_ASSERT_PRECONDITION( lk.owns_lock(mtx_), lock_error() ); /*< run time check throw if not locks the same >*/
return obj_;
}
const T& get(strict_lock<mutex_type>& lk) const
{
-
-#ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME /*< define BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME if you don't want to check lk check the same mtx >*/
- if (!lk.owns_lock(mtx_)) throw lock_error(); /*< run time check throw if not locks the same >*/
-#endif
+ BOOST_THREAD_ASSERT_PRECONDITION( lk.owns_lock(mtx_), lock_error() ); /*< run time check throw if not locks the same >*/
return obj_;
}
@@ -107,10 +101,7 @@
T& get(nested_strict_lock<Lock>& lk)
{
BOOST_STATIC_ASSERT( (is_same<mutex_type, typename Lock::mutex_type>::value)); /*< that locks the same type >*/
-
-#ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME /*< define BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME if you don't want to check lk check the same mtx >*/
- if (!lk.owns_lock(mtx_)) throw lock_error(); /*< run time check throw if not locks the same >*/
-#endif
+ BOOST_THREAD_ASSERT_PRECONDITION( lk.owns_lock(mtx_), lock_error() ); /*< run time check throw if not locks the same >*/
return obj_;
}
@@ -118,10 +109,7 @@
const T& get(nested_strict_lock<Lock>& lk) const
{
BOOST_STATIC_ASSERT( (is_same<mutex_type, typename Lock::mutex_type>::value)); /*< that locks the same type >*/
-
-#ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME /*< define BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME if you don't want to check lk check the same mtx >*/
- if (!lk.owns_lock(mtx_)) throw lock_error(); /*< run time check throw if not locks the same >*/
-#endif
+ BOOST_THREAD_ASSERT_PRECONDITION( lk.owns_lock(mtx_), lock_error() ); /*< run time check throw if not locks the same >*/
return obj_;
}
@@ -138,12 +126,9 @@
BOOST_STATIC_ASSERT( (is_strict_lock<Lock>::value)); /*< lk is a strict lock "sur parolle" >*/
BOOST_STATIC_ASSERT( (is_same<mutex_type, typename Lock::mutex_type>::value)); /*< that locks the same type >*/
-#ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_OWNERSHIP /*< define BOOST_THREAD_EXTERNALLY_LOCKED_NO_CHECK_OWNERSHIP if you don't want to check lock ownership >*/
- if (!lk.own_lock()) throw lock_error(); /*< run time check throw if no locked >*/
-#endif
-#ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME
- if (!lk.owns_lock(mtx_)) throw lock_error();
-#endif
+ BOOST_THREAD_ASSERT_PRECONDITION( lk.owns_lock(), lock_error() ); /*< run time check throw if no locked >*/
+ BOOST_THREAD_ASSERT_PRECONDITION( lk.owns_lock(mtx_), lock_error() ); /*< run time check throw if not locks the same >*/
+
return obj_;
}
@@ -222,19 +207,13 @@
*/
T& get(strict_lock<mutex_type> const& lk)
{
-
-#ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME /*< define BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME if you don't want to check lk check the same mtx >*/
- if (!lk.owns_lock(mtx_)) throw lock_error(); /*< run time check throw if not locks the same >*/
-#endif
+ BOOST_THREAD_ASSERT_PRECONDITION( lk.owns_lock(mtx_), lock_error() ); /*< run time check throw if not locks the same >*/
return *obj_;
}
const T& get(strict_lock<mutex_type> const& lk) const
{
-
-#ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME /*< define BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME if you don't want to check lk check the same mtx >*/
- if (!lk.owns_lock(mtx_)) throw lock_error(); /*< run time check throw if not locks the same >*/
-#endif
+ BOOST_THREAD_ASSERT_PRECONDITION( lk.owns_lock(mtx_), lock_error() ); /*< run time check throw if not locks the same >*/
return *obj_;
}
@@ -242,10 +221,7 @@
T& get(nested_strict_lock<Lock> const& lk)
{
BOOST_STATIC_ASSERT( (is_same<mutex_type, typename Lock::mutex_type>::value)); /*< that locks the same type >*/
-
-#ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME /*< define BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME if you don't want to check lk check the same mtx >*/
- if (!lk.owns_lock(mtx_)) throw lock_error(); /*< run time check throw if not locks the same >*/
-#endif
+ BOOST_THREAD_ASSERT_PRECONDITION( lk.owns_lock(mtx_), lock_error() ); /*< run time check throw if not locks the same >*/
return *obj_;
}
@@ -253,10 +229,7 @@
const T& get(nested_strict_lock<Lock> const& lk) const
{
BOOST_STATIC_ASSERT( (is_same<mutex_type, typename Lock::mutex_type>::value)); /*< that locks the same type >*/
-
-#ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME /*< define BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME if you don't want to check lk check the same mtx >*/
- if (!lk.owns_lock(&mtx_)) throw lock_error(); /*< run time check throw if not locks the same >*/
-#endif
+ BOOST_THREAD_ASSERT_PRECONDITION( lk.owns_lock(mtx_), lock_error() ); /*< run time check throw if not locks the same >*/
return *obj_;
}
@@ -272,13 +245,8 @@
BOOST_CONCEPT_ASSERT(( StrictLock<Lock> ));
BOOST_STATIC_ASSERT( (is_strict_lock<Lock>::value)); /*< lk is a strict lock "sur parolle" >*/
BOOST_STATIC_ASSERT( (is_same<mutex_type, typename Lock::mutex_type>::value)); /*< that locks the same type >*/
-
-#ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_OWNERSHIP /*< define BOOST_THREAD_EXTERNALLY_LOCKED_NO_CHECK_OWNERSHIP if you don't want to check lock ownership >*/
- if (!lk.own_lock()) throw lock_error(); /*< run time check throw if no locked >*/
-#endif
-#ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME
- if (!lk.owns_lock(mtx_)) throw lock_error();
-#endif
+ BOOST_THREAD_ASSERT_PRECONDITION( lk.owns_lock(), lock_error() ); /*< run time check throw if no locked >*/
+ BOOST_THREAD_ASSERT_PRECONDITION( lk.owns_lock(mtx_), lock_error() ); /*< run time check throw if not locks the same >*/
return *obj_;
}
@@ -294,13 +262,8 @@
BOOST_CONCEPT_ASSERT(( StrictLock<Lock> ));
BOOST_STATIC_ASSERT( (is_strict_lock<Lock>::value)); /*< lk is a strict lock "sur parolle" >*/
BOOST_STATIC_ASSERT( (is_same<mutex_type, typename Lock::mutex_type>::value)); /*< that locks the same type >*/
-
-#ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_OWNERSHIP /*< define BOOST_THREAD_EXTERNALLY_LOCKED_NO_CHECK_OWNERSHIP if you don't want to check lock ownership >*/
- if (!lk.own_lock()) throw lock_error(); /*< run time check throw if no locked >*/
-#endif
-#ifndef BOOST_THREAD_EXTERNALLY_LOCKED_DONT_CHECK_SAME
- if (!lk.owns_lock(mtx_)) throw lock_error();
-#endif
+ BOOST_THREAD_ASSERT_PRECONDITION( lk.owns_lock(), lock_error() ); /*< run time check throw if no locked >*/
+ BOOST_THREAD_ASSERT_PRECONDITION( lk.owns_lock(mtx_), lock_error() ); /*< run time check throw if not locks the same >*/
return *obj_;
}
mutex_type* mutex()
Modified: trunk/boost/thread/future.hpp
==============================================================================
--- trunk/boost/thread/future.hpp (original)
+++ trunk/boost/thread/future.hpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -2903,7 +2903,7 @@
BOOST_THREAD_FUTURE<R>
async(R(*f)())
{
- return async(launch::any, f);
+ return BOOST_THREAD_MAKE_RV_REF(async(launch(launch::any), f));
}
#endif
@@ -2989,7 +2989,7 @@
BOOST_THREAD_FUTURE<typename boost::result_of<F()>::type>
async(BOOST_THREAD_RV_REF(F) f)
{
- return async(launch::any, boost::forward<F>(f));
+ return async(launch(launch::any), boost::forward<F>(f));
}
Modified: trunk/boost/thread/scoped_thread.hpp
==============================================================================
--- trunk/boost/thread/scoped_thread.hpp (original)
+++ trunk/boost/thread/scoped_thread.hpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -117,6 +117,11 @@
{
}
+// explicit operator thread()
+// {
+// return boost::move(t_);
+// }
+
/**
* Move constructor.
*/
Modified: trunk/boost/thread/strict_lock.hpp
==============================================================================
--- trunk/boost/thread/strict_lock.hpp (original)
+++ trunk/boost/thread/strict_lock.hpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -130,12 +130,10 @@
nested_strict_lock(Lock& lk) :
lk_(lk) /*< Store reference to lk >*/
{
-#ifdef BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED /*< Define BOOST_THREAD_DONT_CHECK_PRECONDITIONS if you don't want to check lk ownership >*/
- if (lk.mutex() == 0)
- {
- throw_exception( lock_error() );
- }
-#endif
+ /*< Define BOOST_THREAD_DONT_CHECK_PRECONDITIONS if you don't want to check lk ownership >*/
+ BOOST_THREAD_ASSERT_PRECONDITION( lk.mutex() != 0,
+ lock_error()
+ );
if (!lk.owns_lock()) lk.lock(); /*< ensures it is locked >*/
tmp_lk_ = move(lk); /*< Move ownership to temporary lk >*/
}
Modified: trunk/boost/thread/win32/basic_recursive_mutex.hpp
==============================================================================
--- trunk/boost/thread/win32/basic_recursive_mutex.hpp (original)
+++ trunk/boost/thread/win32/basic_recursive_mutex.hpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -58,6 +58,7 @@
recursion_count=1;
}
}
+#if defined BOOST_THREAD_USES_DATETIME
bool timed_lock(::boost::system_time const& target)
{
long const current_thread_id=win32::GetCurrentThreadId();
@@ -68,6 +69,7 @@
{
return timed_lock(get_system_time()+timeout);
}
+#endif
#ifdef BOOST_THREAD_USES_CHRONO
template <class Rep, class Period>
@@ -114,6 +116,7 @@
return false;
}
+#if defined BOOST_THREAD_USES_DATETIME
bool try_timed_lock(long current_thread_id,::boost::system_time const& target)
{
if(mutex.timed_lock(target))
@@ -124,6 +127,7 @@
}
return false;
}
+#endif
template <typename TP>
bool try_timed_lock_until(long current_thread_id,TP const& target)
{
Modified: trunk/boost/thread/win32/basic_timed_mutex.hpp
==============================================================================
--- trunk/boost/thread/win32/basic_timed_mutex.hpp (original)
+++ trunk/boost/thread/win32/basic_timed_mutex.hpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -14,7 +14,9 @@
#include <boost/thread/win32/thread_primitives.hpp>
#include <boost/thread/win32/interlocked_read.hpp>
#include <boost/thread/thread_time.hpp>
+#if defined BOOST_THREAD_USES_DATETIME
#include <boost/thread/xtime.hpp>
+#endif
#include <boost/detail/interlocked.hpp>
#ifdef BOOST_THREAD_USES_CHRONO
#include <boost/chrono/system_clocks.hpp>
@@ -118,6 +120,7 @@
}
+#if defined BOOST_THREAD_USES_DATETIME
bool timed_lock(::boost::system_time const& wait_until)
{
if(try_lock())
@@ -147,7 +150,6 @@
return true;
}
-
template<typename Duration>
bool timed_lock(Duration const& timeout)
{
@@ -158,7 +160,7 @@
{
return timed_lock(system_time(timeout));
}
-
+#endif
#ifdef BOOST_THREAD_USES_CHRONO
template <class Rep, class Period>
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time)
Modified: trunk/boost/thread/win32/condition_variable.hpp
==============================================================================
--- trunk/boost/thread/win32/condition_variable.hpp (original)
+++ trunk/boost/thread/win32/condition_variable.hpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -11,7 +11,9 @@
#include <boost/thread/win32/thread_data.hpp>
#include <boost/thread/win32/interlocked_read.hpp>
#include <boost/thread/cv_status.hpp>
+#if defined BOOST_THREAD_USES_DATETIME
#include <boost/thread/xtime.hpp>
+#endif
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread_time.hpp>
#include <boost/thread/lock_guard.hpp>
@@ -323,6 +325,7 @@
}
+#if defined BOOST_THREAD_USES_DATETIME
bool timed_wait(unique_lock<mutex>& m,boost::system_time const& abs_time)
{
return do_wait(m,abs_time);
@@ -353,7 +356,7 @@
{
return do_wait(m,wait_duration.total_milliseconds(),pred);
}
-
+#endif
#ifdef BOOST_THREAD_USES_CHRONO
template <class Clock, class Duration>
@@ -430,6 +433,7 @@
while(!pred()) wait(m);
}
+#if defined BOOST_THREAD_USES_DATETIME
template<typename lock_type>
bool timed_wait(lock_type& m,boost::system_time const& abs_time)
{
@@ -465,6 +469,7 @@
{
return do_wait(m,wait_duration.total_milliseconds(),pred);
}
+#endif
#ifdef BOOST_THREAD_USES_CHRONO
template <class lock_type, class Clock, class Duration>
Modified: trunk/boost/thread/win32/recursive_mutex.hpp
==============================================================================
--- trunk/boost/thread/win32/recursive_mutex.hpp (original)
+++ trunk/boost/thread/win32/recursive_mutex.hpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -12,6 +12,7 @@
#include <boost/thread/win32/basic_recursive_mutex.hpp>
#include <boost/thread/exceptions.hpp>
+#include <boost/thread/detail/delete.hpp>
#if defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
#include <boost/thread/lock_types.hpp>
#endif
Modified: trunk/boost/thread/win32/shared_mutex.hpp
==============================================================================
--- trunk/boost/thread/win32/shared_mutex.hpp (original)
+++ trunk/boost/thread/win32/shared_mutex.hpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -136,12 +136,12 @@
BOOST_VERIFY(timed_lock_shared(::boost::detail::get_system_time_sentinel()));
}
+#if defined BOOST_THREAD_USES_DATETIME
template<typename TimeDuration>
bool timed_lock_shared(TimeDuration const & relative_time)
{
return timed_lock_shared(get_system_time()+relative_time);
}
-
bool timed_lock_shared(boost::system_time const& wait_until)
{
for(;;)
@@ -220,6 +220,7 @@
BOOST_ASSERT(res==0);
}
}
+#endif
#ifdef BOOST_THREAD_USES_CHRONO
template <class Rep, class Period>
Modified: trunk/boost/thread/xtime.hpp
==============================================================================
--- trunk/boost/thread/xtime.hpp (original)
+++ trunk/boost/thread/xtime.hpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -9,6 +9,7 @@
#define BOOST_XTIME_WEK070601_HPP
#include <boost/thread/detail/config.hpp>
+#if defined BOOST_THREAD_USES_DATETIME
#include <boost/cstdint.hpp>
#include <boost/thread/thread_time.hpp>
@@ -88,5 +89,5 @@
} // namespace boost
#include <boost/config/abi_suffix.hpp>
-
+#endif
#endif //BOOST_XTIME_WEK070601_HPP
Modified: trunk/libs/thread/doc/changes.qbk
==============================================================================
--- trunk/libs/thread/doc/changes.qbk (original)
+++ trunk/libs/thread/doc/changes.qbk 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -12,50 +12,54 @@
Breaking changes:
+[warning
BOOST_THREAD_VERSION==3 by default since Boost 1.53. So that all the deprecated features since 1.50 are not included by default. You can change this by setting the appropriated define (see Configuration section).
+]
-Deprecated Features:
+Deprecated features:
-Deprecated features since boost 1.53 available only until boost 1.58:
+[warning Deprecated features since boost 1.53 will be available only until boost 1.58.]
-* packaged_task<R> is deprecated, use instead packaged_task<R()>. See BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK and BOOST_THREAD_DONT_PROVIDE_SIGNATURE_PACKAGED_TASK
+* C++11 compliance: packaged_task<R> is deprecated, use instead packaged_task<R()>.
+See BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK and BOOST_THREAD_DONT_PROVIDE_SIGNATURE_PACKAGED_TASK
* [@http://svn.boost.org/trac/boost/ticket/7537 #7537] deprecate Mutex::scoped_lock and scoped_try_lock and boost::condition
New Features:
-
-
* [@http://svn.boost.org/trac/boost/ticket/6270 #6270] c++11 compliance: Add thread constructor from movable callable and movable arguments
Provided when BOOST_THREAD_PROVIDES_VARIADIC_THREAD is defined (Default value from Boost 1.55):
See BOOST_THREAD_PROVIDES_VARIADIC_THREAD and BOOST_THREAD_DONT_PROVIDE_VARIADIC_THREAD.
+* [@http://svn.boost.org/trac/boost/ticket/7280 #7280] C++11 compliance: Add promise::...at_thread_exit functions
+
* [@http://svn.boost.org/trac/boost/ticket/7281 #7281] C++11 compliance: Add ArgTypes to packaged_task template.
Provided when BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK is defined (Default value from Boost 1.55).
See BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK and BOOST_THREAD_DONT_PROVIDE_SIGNATURE_PACKAGED_TASK.
-* [@http://svn.boost.org/trac/boost/ticket/7412 #7412] c++11 compliance: Add async from movable callable and movable arguments
+* [@http://svn.boost.org/trac/boost/ticket/7282 #7282] C++11 compliance: Add packaged_task::make_ready_at_thread_exit function
+
+* [@http://svn.boost.org/trac/boost/ticket/7412 #7412] C++11 compliance: Add async from movable callable and movable arguments
Provided when BOOST_THREAD_PROVIDES_VARIADIC_THREAD and BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK are defined (Default value from Boost 1.55):
See BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK and BOOST_THREAD_DONT_PROVIDE_SIGNATURE_PACKAGED_TASK, BOOST_THREAD_PROVIDES_VARIADIC_THREAD and BOOST_THREAD_DONT_PROVIDE_VARIADIC_THREAD.
-[/* [@http://svn.boost.org/trac/boost/ticket/7413 #7413] c++11 compliance: Add async when the launch policy is deferred.]
-* [@http://svn.boost.org/trac/boost/ticket/7414 #7414] c++11 compliance: future::get post-condition should be valid()==false.
+* [@http://svn.boost.org/trac/boost/ticket/7413 #7413] C++11 compliance: Add async when the launch policy is deferred.
+* [@http://svn.boost.org/trac/boost/ticket/7414 #7414] C++11 compliance: future::get post-condition should be valid()==false.
* [@http://svn.boost.org/trac/boost/ticket/7414 #7444] Async: Add make_future/make_shared_future.
* [@http://svn.boost.org/trac/boost/ticket/7445 #7445] Async: Add future<>.then.
* [@http://svn.boost.org/trac/boost/ticket/7449 #7449] Synchro: Add a synchronized value class.
-* [@http://svn.boost.org/trac/boost/ticket/7540 #7540] Add a helper class that join a thread on destruction.
-* [@http://svn.boost.org/trac/boost/ticket/7541 #7541] Add a thread wrapper class that joins on destruction.
-* [@http://svn.boost.org/trac/boost/ticket/7587 #7587] Add strict_lock and nested_strict_lock
-* [@http://svn.boost.org/trac/boost/ticket/7588 #7588] Split the locks.hpp in several files to limit depedencies
-* [@http://svn.boost.org/trac/boost/ticket/7589 #7589] Add polymorphic lockables
-* [@http://svn.boost.org/trac/boost/ticket/7590 #7590] Add lockable concept checkers based on Boost.ConceptCheck
-* [@http://svn.boost.org/trac/boost/ticket/7592 #7592] Add a null_mutex that is a no-op and that is a model of UpgardeLockable
-* [@http://svn.boost.org/trac/boost/ticket/7593 #7593] Add a externally_locked class
-* [@http://svn.boost.org/trac/boost/ticket/7590 #7594] Allow to disable thread interruptions
+* [@http://svn.boost.org/trac/boost/ticket/7540 #7540] Threads: Add a helper class that join a thread on destruction.
+* [@http://svn.boost.org/trac/boost/ticket/7541 #7541] Threads: Add a thread wrapper class that joins on destruction.
+* [@http://svn.boost.org/trac/boost/ticket/7587 #7587] Synchro: Add strict_lock and nested_strict_lock
+* [@http://svn.boost.org/trac/boost/ticket/7588 #7588] Synchro: Split the locks.hpp in several files to limit dependencies
+* [@http://svn.boost.org/trac/boost/ticket/7589 #7589] Synchro: Add polymorphic lockables
+* [@http://svn.boost.org/trac/boost/ticket/7590 #7590] Synchro: Add lockable concept checkers based on Boost.ConceptCheck
+* [@http://svn.boost.org/trac/boost/ticket/7592 #7592] Synchro: Add a null_mutex that is a no-op and that is a model of UpgardeLockable
+* [@http://svn.boost.org/trac/boost/ticket/7593 #7593] Synchro: Add a externally_locked class
+* [@http://svn.boost.org/trac/boost/ticket/7590 #7594] Threads: Allow to disable thread interruptions
Fixed Bugs:
-
[heading Version 3.1.0 - boost 1.52]
Deprecated Features:
Modified: trunk/libs/thread/doc/configuration.qbk
==============================================================================
--- trunk/libs/thread/doc/configuration.qbk (original)
+++ trunk/libs/thread/doc/configuration.qbk 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -9,6 +9,17 @@
[section:configuration Configuration]
+[table Default Values for Configurable Features
+ [[Feature] [Anti-Feature] [V2] [V3] [V4] ]
+ [[USES_CHRONO] [DONT_USE_CHRONO] [YES] [YES] [YES] ]
+ [[USES_MOVE] [DONT_USE_MOVE] [YES] [YES] [YES] ]
+ [[USES_DATETIME] [DONT_USE_DATETIME] [YES] [NO] [NO] ]
+ [[PROVIDES_THREAD_EQ] [DONT_PROVIDE_THREAD_EQ] [YES] [YES] [NO] ]
+ [[PROVIDES_CONDITION] [DONT_PROVIDE_CONDITION] [YES] [YES] [NO] ]
+ [[PROVIDES_NESTED_LOCKS] [DONT_PROVIDE_NESTED_LOCKS] [YES] [YES] [NO] ]
+ [[PROVIDES_BASIC_THREAD_ID] [PROVIDES_BASIC_THREAD_ID] [NO] [YES] [YES] ]
+]
+
[section:chrono Boost.Chrono]
Boost.Thread uses by default Boost.Chrono for the time related functions and define `BOOST_THREAD_USES_CHRONO` if `BOOST_THREAD_DONT_USE_CHRONO` is not defined. The user should define `BOOST_THREAD_DONT_USE_CHRONO` for compilers that don't work well with Boost.Chrono.
Modified: trunk/libs/thread/doc/future_ref.qbk
==============================================================================
--- trunk/libs/thread/doc/future_ref.qbk (original)
+++ trunk/libs/thread/doc/future_ref.qbk 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -407,9 +407,14 @@
[[Postconditions:] [[unique_future_is_ready_link `this->is_ready()`] returns `true`. [unique_future_get_state_link
`this->get_state()`] returns __ready__.]]
-[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result
-associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception stored in the
-asynchronous result in place of a value.]]
+[[Throws:] [
+
+- __future_uninitialized__ if `*this` is not associated with an asynchronous result.
+
+- __thread_interrupted__ if the result associated with `*this` is not ready at the point of the call, and the current thread is interrupted.
+
+- Any exception stored in the asynchronous result in place of a value.
+]]
[[Notes:] [`get()` is an ['interruption point].]]
@@ -426,9 +431,14 @@
[[Effects:] [If `*this` is associated with an asynchronous result, waits until the result is ready. If the result is not ready on
entry, and the result has a ['wait callback] set, that callback is invoked prior to waiting.]]
-[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result
-associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception thrown by the
-['wait callback] if such a callback is called.]]
+[[Throws:] [
+
+- __future_uninitialized__ if `*this` is not associated with an asynchronous result.
+
+- __thread_interrupted__ if the result
+associated with `*this` is not ready at the point of the call, and the current thread is interrupted.
+
+- Any exception thrown by the ['wait callback] if such a callback is called.]]
[[Postconditions:] [[unique_future_is_ready_link `this->is_ready()`] returns `true`. [unique_future_get_state_link
`this->get_state()`] returns __ready__.]]
@@ -461,9 +471,13 @@
[[Returns:] [`true` if `*this` is associated with an asynchronous result, and that result is ready before the specified time has
elapsed, `false` otherwise.]]
-[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result
-associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception thrown by the
-['wait callback] if such a callback is called.]]
+[[Throws:] [
+
+- __future_uninitialized__ if `*this` is not associated with an asynchronous result.
+
+- __thread_interrupted__ if the result associated with `*this` is not ready at the point of the call, and the current thread is interrupted.
+
+- Any exception thrown by the ['wait callback] if such a callback is called.]]
[[Postconditions:] [If this call returned `true`, then [unique_future_is_ready_link `this->is_ready()`] returns `true` and
[unique_future_get_state_link `this->get_state()`] returns __ready__.]]
@@ -495,9 +509,13 @@
[[Returns:] [`true` if `*this` is associated with an asynchronous result, and that result is ready before the specified time has
passed, `false` otherwise.]]
-[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result
-associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception thrown by the
-['wait callback] if such a callback is called.]]
+[[Throws:] [
+
+- __future_uninitialized__ if `*this` is not associated with an asynchronous result.
+
+- __thread_interrupted__ if the result associated with `*this` is not ready at the point of the call, and the current thread is interrupted.
+
+- Any exception thrown by the ['wait callback] if such a callback is called.]]
[[Postconditions:] [If this call returned `true`, then [unique_future_is_ready_link `this->is_ready()`] returns `true` and
[unique_future_get_state_link `this->get_state()`] returns __ready__.]]
@@ -529,9 +547,13 @@
]]
-[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result
-associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception thrown by the
-['wait callback] if such a callback is called.]]
+[[Throws:] [
+
+- __future_uninitialized__ if `*this` is not associated with an asynchronous result.
+
+- __thread_interrupted__ if the result associated with `*this` is not ready at the point of the call, and the current thread is interrupted.
+
+- Any exception thrown by the ['wait callback] if such a callback is called.]]
[[Postconditions:] [If this call returned `true`, then [unique_future_is_ready_link `this->is_ready()`] returns `true` and
[unique_future_get_state_link `this->get_state()`] returns __ready__.]]
@@ -563,9 +585,13 @@
]]
-[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result
-associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception thrown by the
-['wait callback] if such a callback is called.]]
+[[Throws:] [
+
+- __future_uninitialized__ if `*this` is not associated with an asynchronous result.
+
+- __thread_interrupted__ if the result associated with `*this` is not ready at the point of the call, and the current thread is interrupted.
+
+- Any exception thrown by the ['wait callback] if such a callback is called.]]
[[Postconditions:] [If this call returned `true`, then [unique_future_is_ready_link `this->is_ready()`] returns `true` and
[unique_future_get_state_link `this->get_state()`] returns __ready__.]]
@@ -786,8 +812,12 @@
[[Returns:] [If the result type `R` is a reference, returns the stored reference. If `R` is `void`, there is no return
value. Otherwise, returns a `const` reference to the value stored in the asynchronous result.]]
-[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the
-result associated with `*this` is not ready at the point of the call, and the current thread is interrupted.]]
+[[Throws:] [
+
+- __future_uninitialized__ if `*this` is not associated with an asynchronous result.
+
+- __thread_interrupted__ if the result associated with `*this` is not ready at the point of the call, and the current thread is interrupted.
+]]
[[Notes:] [`get()` is an ['interruption point].]]
@@ -804,8 +834,12 @@
[[Effects:] [If `*this` is associated with an asynchronous result, waits until the result is ready. If the result is not ready on
entry, and the result has a ['wait callback] set, that callback is invoked prior to waiting.]]
-[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result
-associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception thrown by the
+[[Throws:] [
+- __future_uninitialized__ if `*this` is not associated with an asynchronous result.
+
+- __thread_interrupted__ if the result associated with `*this` is not ready at the point of the call, and the current thread is interrupted.
+
+- Any exception thrown by the
['wait callback] if such a callback is called.]]
[[Postconditions:] [[shared_future_is_ready_link `this->is_ready()`] returns `true`. [shared_future_get_state_link
@@ -831,9 +865,13 @@
[[Returns:] [`true` if `*this` is associated with an asynchronous result, and that result is ready before the specified time has
elapsed, `false` otherwise.]]
-[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result
-associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception thrown by the
-['wait callback] if such a callback is called.]]
+[[Throws:] [
+
+- __future_uninitialized__ if `*this` is not associated with an asynchronous result.
+
+- __thread_interrupted__ if the result associated with `*this` is not ready at the point of the call, and the current thread is interrupted.
+
+- Any exception thrown by the ['wait callback] if such a callback is called.]]
[[Postconditions:] [If this call returned `true`, then [shared_future_is_ready_link `this->is_ready()`] returns `true` and
[shared_future_get_state_link `this->get_state()`] returns __ready__.]]
@@ -857,9 +895,12 @@
[[Returns:] [`true` if `*this` is associated with an asynchronous result, and that result is ready before the specified time has
passed, `false` otherwise.]]
-[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result
-associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception thrown by the
-['wait callback] if such a callback is called.]]
+[[Throws:] [
+- __future_uninitialized__ if `*this` is not associated with an asynchronous result.
+
+- __thread_interrupted__ if the result associated with `*this` is not ready at the point of the call, and the current thread is interrupted.
+
+- Any exception thrown by the ['wait callback] if such a callback is called.]]
[[Postconditions:] [If this call returned `true`, then [shared_future_is_ready_link `this->is_ready()`] returns `true` and
[shared_future_get_state_link `this->get_state()`] returns __ready__.]]
@@ -892,9 +933,12 @@
]]
-[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result
-associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception thrown by the
-['wait callback] if such a callback is called.]]
+[[Throws:] [
+- __future_uninitialized__ if `*this` is not associated with an asynchronous result.
+
+- __thread_interrupted__ if the result associated with `*this` is not ready at the point of the call, and the current thread is interrupted.
+
+- Any exception thrown by the ['wait callback] if such a callback is called.]]
[[Postconditions:] [If this call returned `true`, then [shared_future_is_ready_link `this->is_ready()`] returns `true` and
[shared_future_get_state_link `this->get_state()`] returns __ready__.]]
@@ -926,9 +970,13 @@
]]
-[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result
-associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception thrown by the
-['wait callback] if such a callback is called.]]
+[[Throws:] [
+- __future_uninitialized__ if `*this` is not associated with an asynchronous result.
+
+- __thread_interrupted__ if the result associated with `*this` is not ready at the point of the call, and the current thread is interrupted.
+
+- Any exception thrown by the ['wait callback] if such a callback is called.
+]]
[[Postconditions:] [If this call returned `true`, then [shared_future_is_ready_link `this->is_ready()`] returns `true` and
[shared_future_get_state_link `this->get_state()`] returns __ready__.]]
@@ -1042,14 +1090,12 @@
__unique_future__<R> get_future();
// Set the value
- void set_value(R& r);
- void set_value(R&& r);
+ void set_value(see below);
void set_exception(boost::exception_ptr e);
// setting the result with deferred notification
- // void set_value_at_thread_exit(const R& r); // NOT YET IMPLEMENTED
- // void set_value_at_thread_exit(see below); // NOT YET IMPLEMENTED
- // void set_exception_at_thread_exit(exception_ptr p); // NOT YET IMPLEMENTED
+ void set_value_at_thread_exit(see below);
+ void set_exception_at_thread_exit(exception_ptr p);
template<typename F>
void set_wait_callback(F f); // EXTENSION
@@ -1163,15 +1209,24 @@
[variablelist
-[[Effects:] [If `*this` was not associated with a result, allocate storage for a new asynchronous result and associate it with
-`*this`. Store the value `r` in the asynchronous result associated with `*this`. Any threads blocked waiting for the asynchronous
-result are woken.]]
+[[Effects:] [
+- If BOOST_THREAD_PROVIDES_PROMISE_LAZY is defined and if `*this` was not associated with a result, allocate storage for a new asynchronous result and associate it with `*this`.
+
+- Store the value `r` in the asynchronous result associated with `*this`. Any threads blocked waiting for the asynchronous
+result are woken.
+]]
[[Postconditions:] [All futures waiting on the asynchronous result are ['ready] and __unique_future_has_value__ or
__shared_future_has_value__ for those futures shall return `true`.]]
-[[Throws:] [__promise_already_satisfied__ if the result associated with `*this` is already ['ready]. `std::bad_alloc` if the memory
-required for storage of the result cannot be allocated. Any exception thrown by the copy or move-constructor of `R`.]]
+[[Throws:] [
+- __promise_already_satisfied__ if the result associated with `*this` is already ['ready].
+
+- __broken_promise__ if `*this` has no shared state.
+
+- `std::bad_alloc` if the memory required for storage of the result cannot be allocated.
+
+- Any exception thrown by the copy or move-constructor of `R`.]]
]
@@ -1183,21 +1238,83 @@
[variablelist
-[[Effects:] [If `*this` was not associated with a result, allocate storage for a new asynchronous result and associate it with
-`*this`. Store the exception `e` in the asynchronous result associated with `*this`. Any threads blocked waiting for the asynchronous
+[[Effects:] [
+- If BOOST_THREAD_PROVIDES_PROMISE_LAZY is defined and if `*this` was not associated with a result, allocate storage for a new asynchronous result and associate it with
+`*this`.
+
+- Store the exception `e` in the asynchronous result associated with `*this`. Any threads blocked waiting for the asynchronous
result are woken.]]
[[Postconditions:] [All futures waiting on the asynchronous result are ['ready] and __unique_future_has_exception__ or
__shared_future_has_exception__ for those futures shall return `true`.]]
-[[Throws:] [__promise_already_satisfied__ if the result associated with `*this` is already ['ready]. `std::bad_alloc` if the memory
-required for storage of the result cannot be allocated.]]
+[[Throws:] [
+- __promise_already_satisfied__ if the result associated with `*this` is already ['ready].
+
+- __broken_promise__ if `*this` has no shared state.
+
+- `std::bad_alloc` if the memory required for storage of the result cannot be allocated.
+]]
]
[endsect]
-[section:set_wait_callback Member Function `set_wait_callback()`]
+[section:set_value_at_thread_exit Member Function `set_value_at_thread_exit()`]
+
+ void set_value_at_thread_exit(R&& r);
+ void set_value_at_thread_exit(const R& r);
+ void promise<R&>::set_value_at_thread_exit(R& r);
+ void promise<void>::set_value_at_thread_exit();
+
+[variablelist
+
+[[Effects:] [
+Stores the value r in the shared state without making that state ready immediately.
+Schedules that state to be made ready when the current thread exits, after all objects of thread storage duration
+associated with the current thread have been destroyed.]]
+
+
+[[Throws:] [
+- __promise_already_satisfied__ if the result associated with `*this` is already ['ready].
+
+- __broken_promise__ if `*this` has no shared state.
+
+- `std::bad_alloc` if the memory required for storage of the result cannot be allocated.
+
+- Any exception thrown by the copy or move-constructor of `R`.
+]]
+
+]
+
+[endsect]
+
+[section:set_exception_at_thread_exit Member Function `set_exception_at_thread_exit()`]
+
+ void set_exception_at_thread_exit(boost::exception_ptr e);
+
+[variablelist
+
+[[Effects:] [
+Stores the exception pointer p in the shared state without making that state ready immediately.
+Schedules that state to be made ready when the current thread exits, after all objects of thread storage duration
+ associated with the current thread have been destroyed.]]
+
+[[Postconditions:] [All futures waiting on the asynchronous result are ['ready] and __unique_future_has_exception__ or
+__shared_future_has_exception__ for those futures shall return `true`.]]
+
+[[Throws:] [
+- __promise_already_satisfied__ if the result associated with `*this` is already ['ready].
+
+- __broken_promise__ if `*this` has no shared state.
+
+- `std::bad_alloc` if the memory required for storage of the result cannot be allocated.
+]]
+
+]
+
+[endsect]
+[section:set_wait_callback Member Function `set_wait_callback()` EXTENSION]
template<typename F>
void set_wait_callback(F f);
@@ -1260,7 +1377,7 @@
// execution
void operator()(ArgTypes... );
- // void make_ready_at_thread_exit(ArgTypes...); // NOT YET IMPLEMENTED
+ void make_ready_at_thread_exit(ArgTypes...);
void reset();
template<typename F>
@@ -1281,8 +1398,12 @@
[[Effects:] [Constructs a new __packaged_task__ with `boost::forward<F>(f)` stored as the associated task.]]
-[[Throws:] [Any exceptions thrown by the copy (or move) constructor of `f`. `std::bad_alloc` if memory for the internal data
-structures could not be allocated.]]
+[[Throws:] [
+
+- Any exceptions thrown by the copy (or move) constructor of `f`.
+
+- `std::bad_alloc` if memory for the internal data structures could not be allocated.
+]]
[[Notes:] [The R(*f)(ArgTypes...)) overload to allow passing a function without needing to use `&`.]]
@@ -1395,13 +1516,40 @@
[[Postconditions:] [All futures waiting on the asynchronous result are ['ready]]]
-[[Throws:] [__task_moved__ if ownership of the task associated with `*this` has been moved to another instance of
-__packaged_task__. __task_already_started__ if the task has already been invoked.]]
+[[Throws:] [
+
+- __task_moved__ if ownership of the task associated with `*this` has been moved to another instance of __packaged_task__.
+
+- __task_already_started__ if the task has already been invoked.]]
+
+]
+
+[endsect]
+
+[section:make_ready_at_thread_exit Member Function `make_ready_at_thread_exit()`]
+
+ void make_ready_at_thread_exit(ArgTypes...);
+
+[variablelist
+
+[[Effects:] [Invoke the task associated with `*this` and store the result in the corresponding future. If the task returns normally,
+the return value is stored as the asynchronous result, otherwise the exception thrown is stored.
+In either case, this is done without making that state ready immediately.
+Schedules the shared state to be made ready when the current thread exits, after all objects of thread storage
+duration associated with the current thread have been destroyed.]]
+
+[[Throws:] [
+
+- __task_moved__ if ownership of the task associated with `*this` has been moved to another instance of __packaged_task__.
+
+- __task_already_started__ if the task has already been invoked.
+]]
]
[endsect]
+
[section:reset Member Function `reset()`]
void reset();
Modified: trunk/libs/thread/example/condition.cpp
==============================================================================
--- trunk/libs/thread/example/condition.cpp (original)
+++ trunk/libs/thread/example/condition.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -7,13 +7,13 @@
#include <iostream>
#include <vector>
#include <boost/utility.hpp>
-#include <boost/thread/condition.hpp>
+#include <boost/thread/condition_variable.hpp>
#include <boost/thread/thread.hpp>
class bounded_buffer : private boost::noncopyable
{
public:
- typedef boost::mutex::scoped_lock lock;
+ typedef boost::unique_lock<boost::mutex> lock;
bounded_buffer(int n) : begin(0), end(0), buffered(0), circular_buf(n) { }
@@ -40,7 +40,7 @@
private:
int begin, end, buffered;
std::vector<int> circular_buf;
- boost::condition buffer_not_full, buffer_not_empty;
+ boost::condition_variable_any buffer_not_full, buffer_not_empty;
boost::mutex monitor;
};
@@ -54,7 +54,7 @@
buf.send(n);
if(!(n%10000))
{
- boost::mutex::scoped_lock io_lock(io_mutex);
+ boost::unique_lock<boost::mutex> io_lock(io_mutex);
std::cout << "sent: " << n << std::endl;
}
++n;
@@ -68,7 +68,7 @@
n = buf.receive();
if(!(n%10000))
{
- boost::mutex::scoped_lock io_lock(io_mutex);
+ boost::unique_lock<boost::mutex> io_lock(io_mutex);
std::cout << "received: " << n << std::endl;
}
} while (n != -1); // -1 indicates end of buffer
Modified: trunk/libs/thread/example/make_future.cpp
==============================================================================
--- trunk/libs/thread/example/make_future.cpp (original)
+++ trunk/libs/thread/example/make_future.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -15,7 +15,7 @@
if (x == 0) return boost::make_future(0);
if (x < 0) return boost::make_future(-1);
//boost::future<int> f1 = boost::async([]() { return x+1; });
- boost::future<int> f1 = boost::async(p1);
+ boost::future<int> f1 = boost::async(boost::launch::async, p1);
return boost::move(f1);
}
boost::shared_future<int> shared_compute(int x)
Modified: trunk/libs/thread/example/monitor.cpp
==============================================================================
--- trunk/libs/thread/example/monitor.cpp (original)
+++ trunk/libs/thread/example/monitor.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -6,7 +6,7 @@
#include <vector>
#include <iostream>
-#include <boost/thread/condition.hpp>
+#include <boost/thread/condition_variable.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/recursive_mutex.hpp>
#include <boost/thread/thread.hpp>
@@ -20,7 +20,7 @@
class buffer_t
{
public:
- typedef typename M::scoped_lock scoped_lock;
+ typedef boost::unique_lock<M> scoped_lock;
buffer_t(int n)
: p(0), c(0), full(0), buf(n)
@@ -60,7 +60,7 @@
for (int n = 0; n < ITERS; ++n)
{
{
- boost::mutex::scoped_lock lock(io_mutex);
+ boost::unique_lock<boost::mutex> lock(io_mutex);
std::cout << "sending: " << n << std::endl;
}
get_buffer().send(n);
@@ -73,7 +73,7 @@
{
int n = get_buffer().receive();
{
- boost::mutex::scoped_lock lock(io_mutex);
+ boost::unique_lock<boost::mutex> lock(io_mutex);
std::cout << "received: " << n << std::endl;
}
}
@@ -81,7 +81,7 @@
private:
M mutex;
- boost::condition cond;
+ boost::condition_variable_any cond;
unsigned int p, c, full;
std::vector<int> buf;
};
Modified: trunk/libs/thread/example/mutex.cpp
==============================================================================
--- trunk/libs/thread/example/mutex.cpp (original)
+++ trunk/libs/thread/example/mutex.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -1,7 +1,7 @@
// Copyright (C) 2001-2003
// William E. Kempf
//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// 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)
#include <boost/thread/mutex.hpp>
@@ -16,7 +16,7 @@
counter() : count(0) { }
int increment() {
- boost::mutex::scoped_lock scoped_lock(mutex);
+ boost::unique_lock<boost::mutex> scoped_lock(mutex);
return ++count;
}
@@ -30,7 +30,7 @@
void change_count()
{
int i = c.increment();
- boost::mutex::scoped_lock scoped_lock(io_mutex);
+ boost::unique_lock<boost::mutex> scoped_lock(io_mutex);
std::cout << "count == " << i << std::endl;
}
Modified: trunk/libs/thread/example/recursive_mutex.cpp
==============================================================================
--- trunk/libs/thread/example/recursive_mutex.cpp (original)
+++ trunk/libs/thread/example/recursive_mutex.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -1,7 +1,7 @@
// Copyright (C) 2001-2003
// William E. Kempf
//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// 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)
#include <boost/thread/recursive_mutex.hpp>
@@ -14,12 +14,12 @@
counter() : count(0) { }
int add(int val) {
- boost::recursive_mutex::scoped_lock scoped_lock(mutex);
+ boost::unique_lock<boost::recursive_mutex> scoped_lock(mutex);
count += val;
return count;
}
int increment() {
- boost::recursive_mutex::scoped_lock scoped_lock(mutex);
+ boost::unique_lock<boost::recursive_mutex> scoped_lock(mutex);
return add(1);
}
Modified: trunk/libs/thread/example/scoped_thread.cpp
==============================================================================
--- trunk/libs/thread/example/scoped_thread.cpp (original)
+++ trunk/libs/thread/example/scoped_thread.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -4,9 +4,9 @@
// 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)
+#define BOOST_THREAD_VERSION 3
#include <iostream>
-//#include <string>
#include <boost/thread/scoped_thread.hpp>
void do_something(int& i)
@@ -36,6 +36,10 @@
{
}
+//void do_something_with_current_thread(boost::thread&& th)
+//{
+// th.join();
+//}
int main()
{
@@ -52,6 +56,14 @@
do_something_in_current_thread();
}
+// {
+// int some_local_state;
+// boost::thread t(( func(some_local_state) ));
+// boost::strict_scoped_thread<> g( (boost::move(t)) );
+//
+// do_something_in_current_thread();
+// do_something_with_current_thread(boost::thread(g));
+// }
return 0;
}
Modified: trunk/libs/thread/example/starvephil.cpp
==============================================================================
--- trunk/libs/thread/example/starvephil.cpp (original)
+++ trunk/libs/thread/example/starvephil.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -25,18 +25,18 @@
void get(int id)
{
- boost::mutex::scoped_lock lock(m_mutex);
+ boost::unique_lock<boost::mutex> lock(m_mutex);
while (m_chickens == 0)
{
{
- boost::mutex::scoped_lock lk(iomx);
+ boost::unique_lock<boost::mutex> lk(iomx);
std::cout << "(" << clock() << ") Phil" << id <<
": wot, no chickens? I'll WAIT ..." << std::endl;
}
m_condition.wait(lock);
}
{
- boost::mutex::scoped_lock lk(iomx);
+ boost::unique_lock<boost::mutex> lk(iomx);
std::cout << "(" << clock() << ") Phil" << id <<
": those chickens look good ... one please ..." << std::endl;
}
@@ -44,9 +44,9 @@
}
void put(int value)
{
- boost::mutex::scoped_lock lock(m_mutex);
+ boost::unique_lock<boost::mutex> lock(m_mutex);
{
- boost::mutex::scoped_lock lk(iomx);
+ boost::unique_lock<boost::mutex> lk(iomx);
std::cout << "(" << clock()
<< ") Chef: ouch ... make room ... this dish is "
<< "very hot ..." << std::endl;
@@ -57,7 +57,7 @@
boost::thread::sleep(xt);
m_chickens += value;
{
- boost::mutex::scoped_lock lk(iomx);
+ boost::unique_lock<boost::mutex> lk(iomx);
std::cout << "(" << clock() <<
") Chef: more chickens ... " << m_chickens <<
" now available ... NOTIFYING ..." << std::endl;
@@ -77,13 +77,13 @@
{
const int chickens = 4;
{
- boost::mutex::scoped_lock lock(iomx);
+ boost::unique_lock<boost::mutex> lock(iomx);
std::cout << "(" << clock() << ") Chef: starting ..." << std::endl;
}
for (;;)
{
{
- boost::mutex::scoped_lock lock(iomx);
+ boost::unique_lock<boost::mutex> lock(iomx);
std::cout << "(" << clock() << ") Chef: cooking ..." << std::endl;
}
boost::xtime xt;
@@ -91,7 +91,7 @@
xt.sec += 2;
boost::thread::sleep(xt);
{
- boost::mutex::scoped_lock lock(iomx);
+ boost::unique_lock<boost::mutex> lock(iomx);
std::cout << "(" << clock() << ") Chef: " << chickens
<< " chickens, ready-to-go ..." << std::endl;
}
@@ -104,7 +104,7 @@
phil(int id) : m_id(id) { }
void run() {
{
- boost::mutex::scoped_lock lock(iomx);
+ boost::unique_lock<boost::mutex> lock(iomx);
std::cout << "(" << clock() << ") Phil" << m_id
<< ": starting ..." << std::endl;
}
@@ -118,13 +118,13 @@
boost::thread::sleep(xt);
}
{
- boost::mutex::scoped_lock lk(iomx);
+ boost::unique_lock<boost::mutex> lk(iomx);
std::cout << "(" << clock() << ") Phil" << m_id
<< ": gotta eat ..." << std::endl;
}
g_canteen.get(m_id);
{
- boost::mutex::scoped_lock lk(iomx);
+ boost::unique_lock<boost::mutex> lk(iomx);
std::cout << "(" << clock() << ") Phil" << m_id
<< ": mmm ... that's good ..." << std::endl;
}
Modified: trunk/libs/thread/example/tennis.cpp
==============================================================================
--- trunk/libs/thread/example/tennis.cpp (original)
+++ trunk/libs/thread/example/tennis.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -41,7 +41,7 @@
void player(void* param)
{
- boost::mutex::scoped_lock lock(mutex);
+ boost::unique_lock<boost::mutex> lock(mutex);
int active = (int)param;
int other = active == PLAYER_A ? PLAYER_B : PLAYER_A;
@@ -108,7 +108,7 @@
xt.sec += 1;
boost::thread::sleep(xt);
{
- boost::mutex::scoped_lock lock(mutex);
+ boost::unique_lock<boost::mutex> lock(mutex);
std::cout << "---Noise ON..." << std::endl;
}
@@ -116,7 +116,7 @@
cond.notify_all();
{
- boost::mutex::scoped_lock lock(mutex);
+ boost::unique_lock<boost::mutex> lock(mutex);
std::cout << "---Noise OFF..." << std::endl;
state = GAME_OVER;
cond.notify_all();
Modified: trunk/libs/thread/example/thread_group.cpp
==============================================================================
--- trunk/libs/thread/example/thread_group.cpp (original)
+++ trunk/libs/thread/example/thread_group.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -12,7 +12,7 @@
void increment_count()
{
- boost::mutex::scoped_lock lock(mutex);
+ boost::unique_lock<boost::mutex> lock(mutex);
std::cout << "count = " << ++count << std::endl;
}
Modified: trunk/libs/thread/src/pthread/thread.cpp
==============================================================================
--- trunk/libs/thread/src/pthread/thread.cpp (original)
+++ trunk/libs/thread/src/pthread/thread.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -10,12 +10,13 @@
#include <boost/thread/detail/config.hpp>
#include <boost/thread/thread.hpp>
+#if defined BOOST_THREAD_USES_DATETIME
#include <boost/thread/xtime.hpp>
+#endif
#include <boost/thread/condition_variable.hpp>
#include <boost/thread/locks.hpp>
#include <boost/thread/once.hpp>
#include <boost/thread/tss.hpp>
-#include <boost/throw_exception.hpp>
#include <boost/thread/future.hpp>
#ifdef __GLIBC__
@@ -422,6 +423,7 @@
/// Workaround of DECCXX issue of incorrect template substitution
template<>
#endif
+#if defined BOOST_THREAD_USES_DATETIME
void sleep(const system_time& st)
{
detail::thread_data_base* const thread_info=detail::get_current_thread_data();
@@ -461,16 +463,19 @@
}
}
}
+#endif
void yield() BOOST_NOEXCEPT
{
# if defined(BOOST_HAS_SCHED_YIELD)
BOOST_VERIFY(!sched_yield());
# elif defined(BOOST_HAS_PTHREAD_YIELD)
BOOST_VERIFY(!pthread_yield());
-# else
+# elif defined BOOST_THREAD_USES_DATETIME
xtime xt;
xtime_get(&xt, TIME_UTC_);
sleep(xt);
+# else
+ sleep_for(chrono::milliseconds(0));
# endif
}
}
Modified: trunk/libs/thread/src/pthread/timeconv.inl
==============================================================================
--- trunk/libs/thread/src/pthread/timeconv.inl (original)
+++ trunk/libs/thread/src/pthread/timeconv.inl 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -17,6 +17,7 @@
const int MICROSECONDS_PER_SECOND = 1000000;
const int NANOSECONDS_PER_MICROSECOND = 1000;
+#if defined BOOST_THREAD_USES_DATETIME
inline void to_time(int milliseconds, boost::xtime& xt)
{
int res = 0;
@@ -33,7 +34,9 @@
xt.nsec -= NANOSECONDS_PER_SECOND;
}
}
+#endif
#if defined(BOOST_HAS_PTHREADS)
+#if defined BOOST_THREAD_USES_DATETIME
inline void to_timespec(const boost::xtime& xt, timespec& ts)
{
ts.tv_sec = static_cast<int>(xt.sec);
@@ -44,14 +47,27 @@
ts.tv_nsec %= NANOSECONDS_PER_SECOND;
}
}
-
+#endif
inline void to_time(int milliseconds, timespec& ts)
{
+#if defined BOOST_THREAD_USES_DATETIME
boost::xtime xt;
to_time(milliseconds, xt);
to_timespec(xt, ts);
+#else
+ ts.tv_sec += (milliseconds / MILLISECONDS_PER_SECOND);
+ ts.tv_nsec += ((milliseconds % MILLISECONDS_PER_SECOND) *
+ NANOSECONDS_PER_MILLISECOND);
+
+ if (ts.tv_nsec >= NANOSECONDS_PER_SECOND)
+ {
+ ++ts.tv_sec;
+ ts.tv_nsec -= NANOSECONDS_PER_SECOND;
+ }
+#endif
}
+#if defined BOOST_THREAD_USES_DATETIME
inline void to_timespec_duration(const boost::xtime& xt, timespec& ts)
{
boost::xtime cur;
@@ -82,7 +98,9 @@
}
}
#endif
+#endif
+#if defined BOOST_THREAD_USES_DATETIME
inline void to_duration(boost::xtime xt, int& milliseconds)
{
boost::xtime cur;
@@ -126,6 +144,7 @@
NANOSECONDS_PER_MICROSECOND);
}
}
+#endif
}
// Change Log:
Modified: trunk/libs/thread/src/win32/thread.cpp
==============================================================================
--- trunk/libs/thread/src/win32/thread.cpp (original)
+++ trunk/libs/thread/src/win32/thread.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -21,9 +21,9 @@
#include <boost/thread/future.hpp>
#include <boost/assert.hpp>
-#include <boost/throw_exception.hpp>
+#if defined BOOST_THREAD_USES_DATETIME
#include <boost/date_time/posix_time/conversion.hpp>
-
+#endif
#include <memory>
#include <algorithm>
#ifndef UNDER_CE
@@ -344,17 +344,15 @@
else
{
return false;
-//#ifdef BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED
-// boost::throw_exception(thread_resource_error(system::errc::invalid_argument, "boost thread: thread not joinable"));
-//#endif
}
}
+#if defined BOOST_THREAD_USES_DATETIME
bool thread::timed_join(boost::system_time const& wait_until)
{
return do_try_join_until(get_milliseconds_until(wait_until));
}
-
+#endif
bool thread::do_try_join_until_noexcept(uintmax_t milli, bool& res)
{
detail::thread_data_ptr local_thread_info=(get_thread_info)();
@@ -372,9 +370,6 @@
else
{
return false;
-//#ifdef BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED
-// boost::throw_exception(thread_resource_error(system::errc::invalid_argument, "boost thread: thread not joinable"));
-//#endif
}
}
Modified: trunk/libs/thread/test/Jamfile.v2
==============================================================================
--- trunk/libs/thread/test/Jamfile.v2 (original)
+++ trunk/libs/thread/test/Jamfile.v2 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -588,6 +588,9 @@
explicit ts_ ;
test-suite ts_
:
+ #[ thread-run test_7665.cpp ]
+ [ thread-run test_7666.cpp ]
+ #[ compile ../example/tes_is_function.cpp ]
#[ thread-run ../example/unwrap.cpp ]
;
Modified: trunk/libs/thread/test/condition_test_common.hpp
==============================================================================
--- trunk/libs/thread/test/condition_test_common.hpp (original)
+++ trunk/libs/thread/test/condition_test_common.hpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -2,7 +2,7 @@
#define CONDITION_TEST_COMMON_HPP
// Copyright (C) 2007 Anthony Williams
//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// 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)
#include <boost/thread/condition_variable.hpp>
@@ -10,14 +10,14 @@
#include <boost/thread/thread_time.hpp>
unsigned const timeout_seconds=5;
-
+
struct wait_for_flag
{
boost::mutex mutex;
boost::condition_variable cond_var;
bool flag;
unsigned woken;
-
+
wait_for_flag():
flag(false),woken(0)
{}
@@ -25,11 +25,11 @@
struct check_flag
{
bool const& flag;
-
+
check_flag(bool const& flag_):
flag(flag_)
{}
-
+
bool operator()() const
{
return flag;
@@ -38,10 +38,10 @@
void operator=(check_flag&);
};
-
+
void wait_without_predicate()
{
- boost::mutex::scoped_lock lock(mutex);
+ boost::unique_lock<boost::mutex> lock(mutex);
while(!flag)
{
cond_var.wait(lock);
@@ -51,7 +51,7 @@
void wait_with_predicate()
{
- boost::mutex::scoped_lock lock(mutex);
+ boost::unique_lock<boost::mutex> lock(mutex);
cond_var.wait(lock,check_flag(flag));
if(flag)
{
@@ -62,8 +62,8 @@
void timed_wait_without_predicate()
{
boost::system_time const timeout=boost::get_system_time()+boost::posix_time::seconds(timeout_seconds);
-
- boost::mutex::scoped_lock lock(mutex);
+
+ boost::unique_lock<boost::mutex> lock(mutex);
while(!flag)
{
if(!cond_var.timed_wait(lock,timeout))
@@ -77,7 +77,7 @@
void timed_wait_with_predicate()
{
boost::system_time const timeout=boost::get_system_time()+boost::posix_time::seconds(timeout_seconds);
- boost::mutex::scoped_lock lock(mutex);
+ boost::unique_lock<boost::mutex> lock(mutex);
if(cond_var.timed_wait(lock,timeout,check_flag(flag)) && flag)
{
++woken;
@@ -85,7 +85,7 @@
}
void relative_timed_wait_with_predicate()
{
- boost::mutex::scoped_lock lock(mutex);
+ boost::unique_lock<boost::mutex> lock(mutex);
if(cond_var.timed_wait(lock,boost::posix_time::seconds(timeout_seconds),check_flag(flag)) && flag)
{
++woken;
Modified: trunk/libs/thread/test/shared_mutex_locking_thread.hpp
==============================================================================
--- trunk/libs/thread/test/shared_mutex_locking_thread.hpp (original)
+++ trunk/libs/thread/test/shared_mutex_locking_thread.hpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -37,15 +37,15 @@
unblocked_count_mutex(unblocked_count_mutex_),
finish_mutex(finish_mutex_)
{}
-
+
void operator()()
{
// acquire lock
lock_type lock(rw_mutex);
-
+
// increment count to show we're unblocked
{
- boost::mutex::scoped_lock ublock(unblocked_count_mutex);
+ boost::unique_lock<boost::mutex> ublock(unblocked_count_mutex);
++unblocked_count;
unblocked_condition.notify_one();
++simultaneous_running_count;
@@ -54,11 +54,11 @@
max_simultaneous_running=simultaneous_running_count;
}
}
-
+
// wait to finish
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
{
- boost::mutex::scoped_lock ublock(unblocked_count_mutex);
+ boost::unique_lock<boost::mutex> ublock(unblocked_count_mutex);
--simultaneous_running_count;
}
}
@@ -72,9 +72,9 @@
boost::mutex& finish_mutex;
boost::mutex& unblocked_mutex;
unsigned& unblocked_count;
-
+
void operator=(simple_writing_thread&);
-
+
public:
simple_writing_thread(boost::shared_mutex& rwm_,
boost::mutex& finish_mutex_,
@@ -83,17 +83,17 @@
rwm(rwm_),finish_mutex(finish_mutex_),
unblocked_mutex(unblocked_mutex_),unblocked_count(unblocked_count_)
{}
-
+
void operator()()
{
boost::unique_lock<boost::shared_mutex> lk(rwm);
-
+
{
- boost::mutex::scoped_lock ulk(unblocked_mutex);
+ boost::unique_lock<boost::mutex> ulk(unblocked_mutex);
++unblocked_count;
}
-
- boost::mutex::scoped_lock flk(finish_mutex);
+
+ boost::unique_lock<boost::mutex> flk(finish_mutex);
}
};
@@ -103,9 +103,9 @@
boost::mutex& finish_mutex;
boost::mutex& unblocked_mutex;
unsigned& unblocked_count;
-
+
void operator=(simple_reading_thread&);
-
+
public:
simple_reading_thread(boost::shared_mutex& rwm_,
boost::mutex& finish_mutex_,
@@ -114,17 +114,17 @@
rwm(rwm_),finish_mutex(finish_mutex_),
unblocked_mutex(unblocked_mutex_),unblocked_count(unblocked_count_)
{}
-
+
void operator()()
{
boost::shared_lock<boost::shared_mutex> lk(rwm);
-
+
{
- boost::mutex::scoped_lock ulk(unblocked_mutex);
+ boost::unique_lock<boost::mutex> ulk(unblocked_mutex);
++unblocked_count;
}
-
- boost::mutex::scoped_lock flk(finish_mutex);
+
+ boost::unique_lock<boost::mutex> flk(finish_mutex);
}
};
Modified: trunk/libs/thread/test/test_2309.cpp
==============================================================================
--- trunk/libs/thread/test/test_2309.cpp (original)
+++ trunk/libs/thread/test/test_2309.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -24,18 +24,18 @@
}
catch (boost::thread_interrupted& interrupt)
{
- boost::mutex::scoped_lock lock(mutex_);
+ boost::unique_lock<boost::mutex> lock(mutex_);
cerr << "Thread " << boost::this_thread::get_id() << " got interrupted" << endl;
throw(interrupt);
}
catch (std::exception& e)
{
- boost::mutex::scoped_lock lock(mutex_);
+ boost::unique_lock<boost::mutex> lock(mutex_);
cerr << "Thread " << boost::this_thread::get_id() << " caught std::exception" << e.what() << endl;
}
catch (...)
{
- boost::mutex::scoped_lock lock(mutex_);
+ boost::unique_lock<boost::mutex> lock(mutex_);
cerr << "Thread " << boost::this_thread::get_id() << " caught something else" << endl;
}
}
Modified: trunk/libs/thread/test/test_3628.cpp
==============================================================================
--- trunk/libs/thread/test/test_3628.cpp (original)
+++ trunk/libs/thread/test/test_3628.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -27,7 +27,7 @@
for (int j = 0; j < 10; j++)
{
{
- boost::recursive_mutex::scoped_lock lockMtx(theMutex);
+ boost::unique_lock<boost::recursive_mutex> lockMtx(theMutex);
theConditions.push_back(&con1);
cout << "Added " << boost::this_thread::get_id() << " " << &con1 << endl;
@@ -56,7 +56,7 @@
for (int j = 0; j < 70; j++)
{
{
- boost::recursive_mutex::scoped_lock lockMtx(theMutex);
+ boost::unique_lock<boost::recursive_mutex> lockMtx(theMutex);
cout << "<Notifier " << j << endl;
unsigned int i = 0;
Modified: trunk/libs/thread/test/test_6130.cpp
==============================================================================
--- trunk/libs/thread/test/test_6130.cpp (original)
+++ trunk/libs/thread/test/test_6130.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -30,7 +30,7 @@
time_t end_time;
assert(now_time < wait_time);
- boost::mutex::scoped_lock lk(mtx);
+ boost::unique_lock<boost::mutex> lk(mtx);
//const bool res =
(void)cv.timed_wait(lk, from_time_t(wait_time));
end_time = ::time(0);
Modified: trunk/libs/thread/test/test_6174.cpp
==============================================================================
--- trunk/libs/thread/test/test_6174.cpp (original)
+++ trunk/libs/thread/test/test_6174.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -4,6 +4,7 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+#define BOOST_THREAD_VERSION 3
#include <boost/thread.hpp>
#include <boost/config.hpp>
Modified: trunk/libs/thread/test/test_7571.cpp
==============================================================================
--- trunk/libs/thread/test/test_7571.cpp (original)
+++ trunk/libs/thread/test/test_7571.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -19,7 +19,7 @@
ItemKeeper() { }
void doSomething() {
- boost::mutex::scoped_lock scoped_lock(mutex);
+ boost::unique_lock<boost::mutex> scoped_lock(mutex);
int counts = MAX_COUNTS;
while (counts--);
}
Added: trunk/libs/thread/test/test_7665.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/thread/test/test_7665.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -0,0 +1,30 @@
+// Copyright (C) 2010 Vicente Botet
+//
+// 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)
+
+#define BOOST_THREAD_VERSION 2
+
+#include <iostream>
+#include <boost/thread.hpp>
+
+void thread()
+{
+ std::cout << "Sleeping for 10 seconds - change time\n";
+ boost::this_thread::sleep_for(boost::chrono::seconds(30));
+ std::cout << "Ended\n";
+ //while (1) ; // Never quit
+}
+
+boost::thread example(thread);
+
+int main()
+{
+ std::cout << "Main thread START\n";
+ boost::this_thread::sleep_for(boost::chrono::seconds(30));
+ std::cout << "Main thread END\n";
+ //while (1) ; // Never quit
+ example.join();
+ return 0;
+}
+
Modified: trunk/libs/thread/test/test_barrier.cpp
==============================================================================
--- trunk/libs/thread/test/test_barrier.cpp (original)
+++ trunk/libs/thread/test/test_barrier.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -28,7 +28,7 @@
{
if (gen_barrier.wait())
{
- boost::mutex::scoped_lock lock(mutex);
+ boost::unique_lock<boost::mutex> lock(mutex);
global_parameter++;
}
}
Modified: trunk/libs/thread/test/test_condition.cpp
==============================================================================
--- trunk/libs/thread/test/test_condition.cpp (original)
+++ trunk/libs/thread/test/test_condition.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -30,7 +30,7 @@
void condition_test_thread(condition_test_data* data)
{
- boost::mutex::scoped_lock lock(data->mutex);
+ boost::unique_lock<boost::mutex> lock(data->mutex);
BOOST_CHECK(lock ? true : false);
while (!(data->notified > 0))
data->condition.wait(lock);
@@ -53,7 +53,7 @@
void condition_test_waits(condition_test_data* data)
{
- boost::mutex::scoped_lock lock(data->mutex);
+ boost::unique_lock<boost::mutex> lock(data->mutex);
BOOST_CHECK(lock ? true : false);
// Test wait.
@@ -107,7 +107,7 @@
boost::thread thread(bind(&condition_test_waits, &data));
{
- boost::mutex::scoped_lock lock(data.mutex);
+ boost::unique_lock<boost::mutex> lock(data.mutex);
BOOST_CHECK(lock ? true : false);
boost::thread::sleep(delay(1));
Modified: trunk/libs/thread/test/test_condition_notify_all.cpp
==============================================================================
--- trunk/libs/thread/test/test_condition_notify_all.cpp (original)
+++ trunk/libs/thread/test/test_condition_notify_all.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -30,7 +30,7 @@
}
{
- boost::mutex::scoped_lock lock(data.mutex);
+ boost::unique_lock<boost::mutex> lock(data.mutex);
data.flag=true;
data.cond_var.notify_all();
}
@@ -59,7 +59,7 @@
}
{
- boost::mutex::scoped_lock lock(data.mutex);
+ boost::unique_lock<boost::mutex> lock(data.mutex);
data.flag=true;
data.cond_var.notify_all();
}
@@ -88,7 +88,7 @@
}
{
- boost::mutex::scoped_lock lock(data.mutex);
+ boost::unique_lock<boost::mutex> lock(data.mutex);
data.flag=true;
data.cond_var.notify_all();
}
@@ -117,7 +117,7 @@
}
{
- boost::mutex::scoped_lock lock(data.mutex);
+ boost::unique_lock<boost::mutex> lock(data.mutex);
data.flag=true;
data.cond_var.notify_all();
}
@@ -146,7 +146,7 @@
}
{
- boost::mutex::scoped_lock lock(data.mutex);
+ boost::unique_lock<boost::mutex> lock(data.mutex);
data.flag=true;
data.cond_var.notify_all();
}
@@ -169,7 +169,7 @@
void wait_for_condvar_and_increase_count()
{
- boost::mutex::scoped_lock lk(multiple_wake_mutex);
+ boost::unique_lock<boost::mutex> lk(multiple_wake_mutex);
multiple_wake_cond.wait(lk);
++multiple_wake_count;
}
@@ -193,7 +193,7 @@
boost::this_thread::sleep(boost::posix_time::milliseconds(200));
{
- boost::mutex::scoped_lock lk(multiple_wake_mutex);
+ boost::unique_lock<boost::mutex> lk(multiple_wake_mutex);
BOOST_CHECK(multiple_wake_count==3);
}
Modified: trunk/libs/thread/test/test_condition_notify_one.cpp
==============================================================================
--- trunk/libs/thread/test/test_condition_notify_one.cpp (original)
+++ trunk/libs/thread/test/test_condition_notify_one.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -21,7 +21,7 @@
boost::thread thread(bind(&wait_for_flag::wait_without_predicate, data));
{
- boost::mutex::scoped_lock lock(data.mutex);
+ boost::unique_lock<boost::mutex> lock(data.mutex);
data.flag=true;
data.cond_var.notify_one();
}
@@ -37,7 +37,7 @@
boost::thread thread(bind(&wait_for_flag::wait_with_predicate, data));
{
- boost::mutex::scoped_lock lock(data.mutex);
+ boost::unique_lock<boost::mutex> lock(data.mutex);
data.flag=true;
data.cond_var.notify_one();
}
@@ -53,7 +53,7 @@
boost::thread thread(bind(&wait_for_flag::timed_wait_without_predicate, data));
{
- boost::mutex::scoped_lock lock(data.mutex);
+ boost::unique_lock<boost::mutex> lock(data.mutex);
data.flag=true;
data.cond_var.notify_one();
}
@@ -69,7 +69,7 @@
boost::thread thread(bind(&wait_for_flag::timed_wait_with_predicate, data));
{
- boost::mutex::scoped_lock lock(data.mutex);
+ boost::unique_lock<boost::mutex> lock(data.mutex);
data.flag=true;
data.cond_var.notify_one();
}
@@ -85,7 +85,7 @@
boost::thread thread(bind(&wait_for_flag::relative_timed_wait_with_predicate, data));
{
- boost::mutex::scoped_lock lock(data.mutex);
+ boost::unique_lock<boost::mutex> lock(data.mutex);
data.flag=true;
data.cond_var.notify_one();
}
@@ -102,7 +102,7 @@
void wait_for_condvar_and_increase_count()
{
- boost::mutex::scoped_lock lk(multiple_wake_mutex);
+ boost::unique_lock<boost::mutex> lk(multiple_wake_mutex);
multiple_wake_cond.wait(lk);
++multiple_wake_count;
}
@@ -126,7 +126,7 @@
boost::this_thread::sleep(boost::posix_time::milliseconds(200));
{
- boost::mutex::scoped_lock lk(multiple_wake_mutex);
+ boost::unique_lock<boost::mutex> lk(multiple_wake_mutex);
BOOST_CHECK(multiple_wake_count==3);
}
Modified: trunk/libs/thread/test/test_condition_timed_wait_times_out.cpp
==============================================================================
--- trunk/libs/thread/test/test_condition_timed_wait_times_out.cpp (original)
+++ trunk/libs/thread/test/test_condition_timed_wait_times_out.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -29,7 +29,7 @@
boost::mutex m;
boost::posix_time::seconds const delay(timeout_seconds);
- boost::mutex::scoped_lock lock(m);
+ boost::unique_lock<boost::mutex> lock(m);
boost::system_time const start=boost::get_system_time();
boost::system_time const timeout=start+delay;
@@ -45,7 +45,7 @@
boost::mutex m;
boost::posix_time::seconds const delay(timeout_seconds);
- boost::mutex::scoped_lock lock(m);
+ boost::unique_lock<boost::mutex> lock(m);
boost::system_time const start=boost::get_system_time();
boost::system_time const timeout=start+delay;
@@ -62,7 +62,7 @@
boost::mutex m;
boost::posix_time::seconds const delay(timeout_seconds);
- boost::mutex::scoped_lock lock(m);
+ boost::unique_lock<boost::mutex> lock(m);
boost::system_time const start=boost::get_system_time();
bool const res=cond.timed_wait(lock,delay,fake_predicate);
@@ -78,7 +78,7 @@
boost::mutex m;
boost::posix_time::seconds const delay(timeout_seconds);
- boost::mutex::scoped_lock lock(m);
+ boost::unique_lock<boost::mutex> lock(m);
boost::system_time const start=boost::get_system_time();
while(cond.timed_wait(lock,delay)) {}
@@ -93,7 +93,7 @@
boost::mutex m;
boost::posix_time::seconds const delay(timeout_seconds);
- boost::mutex::scoped_lock lock(m);
+ boost::unique_lock<boost::mutex> lock(m);
boost::system_time const start=boost::get_system_time();
boost::system_time const timeout=start+delay;
@@ -109,7 +109,7 @@
boost::mutex m;
boost::posix_time::seconds const delay(timeout_seconds);
- boost::mutex::scoped_lock lock(m);
+ boost::unique_lock<boost::mutex> lock(m);
boost::system_time const start=boost::get_system_time();
boost::system_time const timeout=start+delay;
@@ -126,7 +126,7 @@
boost::mutex m;
boost::posix_time::seconds const delay(timeout_seconds);
- boost::mutex::scoped_lock lock(m);
+ boost::unique_lock<boost::mutex> lock(m);
boost::system_time const start=boost::get_system_time();
bool const res=cond.timed_wait(lock,delay,fake_predicate);
@@ -142,7 +142,7 @@
boost::mutex m;
boost::posix_time::seconds const delay(timeout_seconds);
- boost::mutex::scoped_lock lock(m);
+ boost::unique_lock<boost::mutex> lock(m);
boost::system_time const start=boost::get_system_time();
while(cond.timed_wait(lock,delay)) {}
Modified: trunk/libs/thread/test/test_generic_locks.cpp
==============================================================================
--- trunk/libs/thread/test/test_generic_locks.cpp (original)
+++ trunk/libs/thread/test/test_generic_locks.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -15,7 +15,7 @@
{
boost::mutex m1,m2;
- boost::mutex::scoped_lock l1(m1,boost::defer_lock),
+ boost::unique_lock<boost::mutex> l1(m1,boost::defer_lock),
l2(m2,boost::defer_lock);
BOOST_CHECK(!l1.owns_lock());
@@ -39,7 +39,7 @@
void wait()
{
- boost::mutex::scoped_lock l(m);
+ boost::unique_lock<boost::mutex> l(m);
while(!flag)
{
cond.wait(l);
@@ -51,7 +51,7 @@
{
boost::system_time const target=boost::get_system_time()+d;
- boost::mutex::scoped_lock l(m);
+ boost::unique_lock<boost::mutex> l(m);
while(!flag)
{
if(!cond.timed_wait(l,target))
@@ -64,7 +64,7 @@
void signal()
{
- boost::mutex::scoped_lock l(m);
+ boost::unique_lock<boost::mutex> l(m);
flag=true;
cond.notify_all();
}
@@ -83,7 +83,7 @@
void lock_pair(boost::mutex* m1,boost::mutex* m2)
{
boost::lock(*m1,*m2);
- boost::mutex::scoped_lock l1(*m1,boost::adopt_lock),
+ boost::unique_lock<boost::mutex> l1(*m1,boost::adopt_lock),
l2(*m2,boost::adopt_lock);
}
@@ -129,7 +129,7 @@
{
boost::mutex m1,m2,m3,m4,m5;
- boost::mutex::scoped_lock l1(m1,boost::defer_lock),
+ boost::unique_lock<boost::mutex> l1(m1,boost::defer_lock),
l2(m2,boost::defer_lock),
l3(m3,boost::defer_lock),
l4(m4,boost::defer_lock),
Modified: trunk/libs/thread/test/test_lock_concept.cpp
==============================================================================
--- trunk/libs/thread/test/test_lock_concept.cpp (original)
+++ trunk/libs/thread/test/test_lock_concept.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -8,6 +8,7 @@
#include <boost/test/unit_test.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/thread/mutex.hpp>
+#include <boost/thread/lock_types.hpp>
#include <boost/thread/shared_mutex.hpp>
#include <boost/thread/thread.hpp>
#include <boost/thread/recursive_mutex.hpp>
@@ -66,7 +67,7 @@
try
{
{
- boost::mutex::scoped_lock lk(done_mutex);
+ boost::unique_lock<boost::mutex> lk(done_mutex);
BOOST_CHECK(done_cond.timed_wait(lk,boost::posix_time::seconds(2),
boost::bind(&this_type::is_done,this)));
BOOST_CHECK(!locked);
@@ -124,7 +125,7 @@
try
{
{
- boost::mutex::scoped_lock lk(done_mutex);
+ boost::unique_lock<boost::mutex> lk(done_mutex);
BOOST_CHECK(done_cond.timed_wait(lk,boost::posix_time::seconds(2),
boost::bind(&this_type::is_done,this)));
BOOST_CHECK(!locked);
@@ -182,7 +183,7 @@
try
{
{
- boost::mutex::scoped_lock lk(done_mutex);
+ boost::unique_lock<boost::mutex> lk(done_mutex);
BOOST_CHECK(done_cond.timed_wait(lk,boost::posix_time::seconds(2),
boost::bind(&this_type::is_done,this)));
BOOST_CHECK(locked);
@@ -307,7 +308,7 @@
try
{
{
- boost::mutex::scoped_lock lk(done_mutex);
+ boost::unique_lock<boost::mutex> lk(done_mutex);
BOOST_CHECK(done_cond.timed_wait(lk,boost::posix_time::seconds(2),
boost::bind(&this_type::is_done,this)));
BOOST_CHECK(!locked);
Modified: trunk/libs/thread/test/test_mutex.cpp
==============================================================================
--- trunk/libs/thread/test/test_mutex.cpp (original)
+++ trunk/libs/thread/test/test_mutex.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -9,6 +9,7 @@
#include <boost/thread/detail/config.hpp>
#include <boost/thread/mutex.hpp>
+#include <boost/thread/lock_types.hpp>
#include <boost/thread/thread.hpp>
#include <boost/thread/recursive_mutex.hpp>
#include <boost/thread/thread_time.hpp>
@@ -154,7 +155,7 @@
try
{
{
- boost::mutex::scoped_lock lk(done_mutex);
+ boost::unique_lock<boost::mutex> lk(done_mutex);
BOOST_CHECK(done_cond.timed_wait(lk,boost::posix_time::seconds(2),
boost::bind(&this_type::is_done,this)));
BOOST_CHECK(!locked);
Modified: trunk/libs/thread/test/test_once.cpp
==============================================================================
--- trunk/libs/thread/test/test_once.cpp (original)
+++ trunk/libs/thread/test/test_once.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -21,7 +21,7 @@
void initialize_variable()
{
// ensure that if multiple threads get in here, they are serialized, so we can see the effect
- boost::mutex::scoped_lock lock(m);
+ boost::unique_lock<boost::mutex> lock(m);
++var_to_init;
}
@@ -39,7 +39,7 @@
break;
}
}
- boost::mutex::scoped_lock lock(m);
+ boost::unique_lock<boost::mutex> lock(m);
BOOST_CHECK_EQUAL(my_once_value, 1);
}
@@ -79,7 +79,7 @@
void operator()() const
{
- boost::mutex::scoped_lock lock(m);
+ boost::unique_lock<boost::mutex> lock(m);
++(*value);
}
};
@@ -98,7 +98,7 @@
break;
}
}
- boost::mutex::scoped_lock lock(m);
+ boost::unique_lock<boost::mutex> lock(m);
BOOST_CHECK_EQUAL(my_once_value, 1);
}
@@ -137,7 +137,7 @@
void operator()() const
{
- boost::mutex::scoped_lock lock(m);
+ boost::unique_lock<boost::mutex> lock(m);
++pass_counter;
if(pass_counter<3)
{
@@ -158,7 +158,7 @@
}
catch(throw_before_third_pass::my_exception)
{
- boost::mutex::scoped_lock lock(m);
+ boost::unique_lock<boost::mutex> lock(m);
++exception_counter;
}
}
Modified: trunk/libs/thread/test/test_shared_mutex.cpp
==============================================================================
--- trunk/libs/thread/test/test_shared_mutex.cpp (original)
+++ trunk/libs/thread/test/test_shared_mutex.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -14,7 +14,7 @@
#define CHECK_LOCKED_VALUE_EQUAL(mutex_name,value,expected_value) \
{ \
- boost::mutex::scoped_lock lock(mutex_name); \
+ boost::unique_lock<boost::mutex> lock(mutex_name); \
BOOST_CHECK_EQUAL(value,expected_value); \
}
@@ -31,7 +31,7 @@
boost::mutex unblocked_count_mutex;
boost::condition_variable unblocked_condition;
boost::mutex finish_mutex;
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
try
{
@@ -42,7 +42,7 @@
}
{
- boost::mutex::scoped_lock lk(unblocked_count_mutex);
+ boost::unique_lock<boost::mutex> lk(unblocked_count_mutex);
while(unblocked_count<number_of_threads)
{
unblocked_condition.wait(lk);
@@ -78,7 +78,7 @@
boost::mutex unblocked_count_mutex;
boost::condition_variable unblocked_condition;
boost::mutex finish_mutex;
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
try
{
@@ -118,7 +118,7 @@
boost::mutex unblocked_count_mutex;
boost::condition_variable unblocked_condition;
boost::mutex finish_mutex;
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
try
{
@@ -126,7 +126,7 @@
pool.create_thread(locking_thread<boost::shared_lock<boost::shared_mutex> >(rw_mutex,unblocked_count,unblocked_count_mutex,unblocked_condition,
finish_mutex,simultaneous_running_count,max_simultaneous_running));
{
- boost::mutex::scoped_lock lk(unblocked_count_mutex);
+ boost::unique_lock<boost::mutex> lk(unblocked_count_mutex);
while(unblocked_count<1)
{
unblocked_condition.wait(lk);
@@ -165,7 +165,7 @@
boost::mutex unblocked_count_mutex;
boost::condition_variable unblocked_condition;
boost::mutex finish_mutex;
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
unsigned const reader_count=10;
@@ -182,7 +182,7 @@
write_lock.unlock();
{
- boost::mutex::scoped_lock lk(unblocked_count_mutex);
+ boost::unique_lock<boost::mutex> lk(unblocked_count_mutex);
while(unblocked_count<reader_count)
{
unblocked_condition.wait(lk);
@@ -217,9 +217,9 @@
boost::mutex unblocked_count_mutex;
boost::condition_variable unblocked_condition;
boost::mutex finish_reading_mutex;
- boost::mutex::scoped_lock finish_reading_lock(finish_reading_mutex);
+ boost::unique_lock<boost::mutex> finish_reading_lock(finish_reading_mutex);
boost::mutex finish_writing_mutex;
- boost::mutex::scoped_lock finish_writing_lock(finish_writing_mutex);
+ boost::unique_lock<boost::mutex> finish_writing_lock(finish_writing_mutex);
unsigned const reader_count=10;
unsigned const writer_count=10;
@@ -238,7 +238,7 @@
finish_writing_mutex,simultaneous_running_writers,max_simultaneous_writers));
}
{
- boost::mutex::scoped_lock lk(unblocked_count_mutex);
+ boost::unique_lock<boost::mutex> lk(unblocked_count_mutex);
while(unblocked_count<reader_count)
{
unblocked_condition.wait(lk);
@@ -250,7 +250,7 @@
finish_reading_lock.unlock();
{
- boost::mutex::scoped_lock lk(unblocked_count_mutex);
+ boost::unique_lock<boost::mutex> lk(unblocked_count_mutex);
while(unblocked_count<(reader_count+1))
{
unblocked_condition.wait(lk);
Modified: trunk/libs/thread/test/test_shared_mutex_part_2.cpp
==============================================================================
--- trunk/libs/thread/test/test_shared_mutex_part_2.cpp (original)
+++ trunk/libs/thread/test/test_shared_mutex_part_2.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -13,7 +13,7 @@
#define CHECK_LOCKED_VALUE_EQUAL(mutex_name,value,expected_value) \
{ \
- boost::mutex::scoped_lock lock(mutex_name); \
+ boost::unique_lock<boost::mutex> lock(mutex_name); \
BOOST_CHECK_EQUAL(value,expected_value); \
}
@@ -40,11 +40,11 @@
boost::upgrade_lock<boost::shared_mutex> lk(rwm);
{
- boost::mutex::scoped_lock ulk(unblocked_mutex);
+ boost::unique_lock<boost::mutex> ulk(unblocked_mutex);
++unblocked_count;
}
- boost::mutex::scoped_lock flk(finish_mutex);
+ boost::unique_lock<boost::mutex> flk(finish_mutex);
}
};
@@ -62,7 +62,7 @@
boost::mutex unblocked_count_mutex;
boost::condition_variable unblocked_condition;
boost::mutex finish_mutex;
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
try
{
@@ -102,7 +102,7 @@
boost::mutex unblocked_count_mutex;
boost::condition_variable unblocked_condition;
boost::mutex finish_mutex;
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
unsigned const reader_count=10;
@@ -117,7 +117,7 @@
pool.create_thread(locking_thread<boost::upgrade_lock<boost::shared_mutex> >(rw_mutex,unblocked_count,unblocked_count_mutex,unblocked_condition,
finish_mutex,simultaneous_running_count,max_simultaneous_running));
{
- boost::mutex::scoped_lock lk(unblocked_count_mutex);
+ boost::unique_lock<boost::mutex> lk(unblocked_count_mutex);
while(unblocked_count<(reader_count+1))
{
unblocked_condition.wait(lk);
@@ -155,7 +155,7 @@
boost::mutex finish_mutex;
boost::mutex unblocked_mutex;
unsigned unblocked_count=0;
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
boost::thread writer(simple_writing_thread(rw_mutex,finish_mutex,unblocked_mutex,unblocked_count));
boost::this_thread::sleep(boost::posix_time::seconds(1));
CHECK_LOCKED_VALUE_EQUAL(unblocked_mutex,unblocked_count,1u);
@@ -178,7 +178,7 @@
boost::mutex finish_mutex;
boost::mutex unblocked_mutex;
unsigned unblocked_count=0;
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
boost::thread writer(simple_writing_thread(rw_mutex,finish_mutex,unblocked_mutex,unblocked_count));
boost::this_thread::sleep(boost::posix_time::seconds(1));
CHECK_LOCKED_VALUE_EQUAL(unblocked_mutex,unblocked_count,1u);
@@ -223,7 +223,7 @@
boost::mutex finish_mutex;
boost::mutex unblocked_mutex;
unsigned unblocked_count=0;
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
boost::thread writer(simple_reading_thread(rw_mutex,finish_mutex,unblocked_mutex,unblocked_count));
boost::thread::sleep(delay(1));
CHECK_LOCKED_VALUE_EQUAL(unblocked_mutex,unblocked_count,1u);
@@ -246,7 +246,7 @@
boost::mutex finish_mutex;
boost::mutex unblocked_mutex;
unsigned unblocked_count=0;
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
boost::thread writer(simple_reading_thread(rw_mutex,finish_mutex,unblocked_mutex,unblocked_count));
boost::thread::sleep(delay(1));
CHECK_LOCKED_VALUE_EQUAL(unblocked_mutex,unblocked_count,1u);
@@ -269,7 +269,7 @@
boost::mutex finish_mutex;
boost::mutex unblocked_mutex;
unsigned unblocked_count=0;
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
boost::thread writer(simple_upgrade_thread(rw_mutex,finish_mutex,unblocked_mutex,unblocked_count));
boost::this_thread::sleep(boost::posix_time::seconds(1));
CHECK_LOCKED_VALUE_EQUAL(unblocked_mutex,unblocked_count,1u);
Modified: trunk/libs/thread/test/test_shared_mutex_timed_locks.cpp
==============================================================================
--- trunk/libs/thread/test/test_shared_mutex_timed_locks.cpp (original)
+++ trunk/libs/thread/test/test_shared_mutex_timed_locks.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -13,7 +13,7 @@
#define CHECK_LOCKED_VALUE_EQUAL(mutex_name,value,expected_value) \
{ \
- boost::mutex::scoped_lock lock(mutex_name); \
+ boost::unique_lock<boost::mutex> lock(mutex_name); \
BOOST_CHECK_EQUAL(value,expected_value); \
}
@@ -24,7 +24,7 @@
boost::mutex finish_mutex;
boost::mutex unblocked_mutex;
unsigned unblocked_count=0;
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
boost::thread writer(simple_writing_thread(rw_mutex,finish_mutex,unblocked_mutex,unblocked_count));
boost::thread::sleep(delay(1));
CHECK_LOCKED_VALUE_EQUAL(unblocked_mutex,unblocked_count,1u);
@@ -89,7 +89,7 @@
boost::mutex finish_mutex;
boost::mutex unblocked_mutex;
unsigned unblocked_count=0;
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
boost::thread reader(simple_reading_thread(rw_mutex,finish_mutex,unblocked_mutex,unblocked_count));
boost::thread::sleep(delay(1));
CHECK_LOCKED_VALUE_EQUAL(unblocked_mutex,unblocked_count,1u);
@@ -125,7 +125,7 @@
boost::mutex finish_mutex;
boost::mutex unblocked_mutex;
unsigned unblocked_count=0;
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
boost::thread writer(simple_writing_thread(rw_mutex,finish_mutex,unblocked_mutex,unblocked_count));
boost::thread::sleep(delay(1));
CHECK_LOCKED_VALUE_EQUAL(unblocked_mutex,unblocked_count,1u);
@@ -190,7 +190,7 @@
boost::mutex finish_mutex;
boost::mutex unblocked_mutex;
unsigned unblocked_count=0;
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
boost::thread reader(simple_reading_thread(rw_mutex,finish_mutex,unblocked_mutex,unblocked_count));
boost::thread::sleep(delay(1));
CHECK_LOCKED_VALUE_EQUAL(unblocked_mutex,unblocked_count,1u);
@@ -226,7 +226,7 @@
boost::mutex finish_mutex;
boost::mutex unblocked_mutex;
unsigned unblocked_count=0;
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
boost::thread reader(simple_reading_thread(rw_mutex,finish_mutex,unblocked_mutex,unblocked_count));
boost::this_thread::sleep(boost::posix_time::seconds(1));
CHECK_LOCKED_VALUE_EQUAL(unblocked_mutex,unblocked_count,1u);
Modified: trunk/libs/thread/test/test_shared_mutex_timed_locks_chrono.cpp
==============================================================================
--- trunk/libs/thread/test/test_shared_mutex_timed_locks_chrono.cpp (original)
+++ trunk/libs/thread/test/test_shared_mutex_timed_locks_chrono.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -15,7 +15,7 @@
#define CHECK_LOCKED_VALUE_EQUAL(mutex_name,value,expected_value) \
{ \
- boost::mutex::scoped_lock lock(mutex_name); \
+ boost::unique_lock<boost::mutex> lock(mutex_name); \
BOOST_CHECK_EQUAL(value,expected_value); \
}
@@ -26,7 +26,7 @@
boost::mutex finish_mutex;
boost::mutex unblocked_mutex;
unsigned unblocked_count=0;
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
boost::thread writer(simple_writing_thread(rw_mutex,finish_mutex,unblocked_mutex,unblocked_count));
boost::this_thread::sleep_for(boost::chrono::seconds(1));
CHECK_LOCKED_VALUE_EQUAL(unblocked_mutex,unblocked_count,1u);
@@ -91,7 +91,7 @@
boost::mutex finish_mutex;
boost::mutex unblocked_mutex;
unsigned unblocked_count=0;
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
boost::thread reader(simple_reading_thread(rw_mutex,finish_mutex,unblocked_mutex,unblocked_count));
boost::this_thread::sleep_for(boost::chrono::seconds(1));
CHECK_LOCKED_VALUE_EQUAL(unblocked_mutex,unblocked_count,1u);
@@ -127,7 +127,7 @@
boost::mutex finish_mutex;
boost::mutex unblocked_mutex;
unsigned unblocked_count=0;
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
boost::thread writer(simple_writing_thread(rw_mutex,finish_mutex,unblocked_mutex,unblocked_count));
boost::this_thread::sleep_for(boost::chrono::seconds(1));
CHECK_LOCKED_VALUE_EQUAL(unblocked_mutex,unblocked_count,1u);
@@ -192,7 +192,7 @@
boost::mutex finish_mutex;
boost::mutex unblocked_mutex;
unsigned unblocked_count=0;
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
boost::thread reader(simple_reading_thread(rw_mutex,finish_mutex,unblocked_mutex,unblocked_count));
boost::this_thread::sleep_for(boost::chrono::seconds(1));
CHECK_LOCKED_VALUE_EQUAL(unblocked_mutex,unblocked_count,1u);
@@ -228,7 +228,7 @@
boost::mutex finish_mutex;
boost::mutex unblocked_mutex;
unsigned unblocked_count=0;
- boost::mutex::scoped_lock finish_lock(finish_mutex);
+ boost::unique_lock<boost::mutex> finish_lock(finish_mutex);
boost::thread reader(simple_reading_thread(rw_mutex,finish_mutex,unblocked_mutex,unblocked_count));
boost::this_thread::sleep_for(boost::chrono::seconds(1));
CHECK_LOCKED_VALUE_EQUAL(unblocked_mutex,unblocked_count,1u);
Modified: trunk/libs/thread/test/test_thread.cpp
==============================================================================
--- trunk/libs/thread/test/test_thread.cpp (original)
+++ trunk/libs/thread/test/test_thread.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -77,7 +77,7 @@
void interruption_point_thread(boost::mutex* m,bool* failed)
{
- boost::mutex::scoped_lock lk(*m);
+ boost::unique_lock<boost::mutex> lk(*m);
boost::this_thread::interruption_point();
*failed=true;
}
@@ -86,7 +86,7 @@
{
boost::mutex m;
bool failed=false;
- boost::mutex::scoped_lock lk(m);
+ boost::unique_lock<boost::mutex> lk(m);
boost::thread thrd(boost::bind(&interruption_point_thread,&m,&failed));
thrd.interrupt();
lk.unlock();
@@ -101,7 +101,7 @@
void disabled_interruption_point_thread(boost::mutex* m,bool* failed)
{
- boost::mutex::scoped_lock lk(*m);
+ boost::unique_lock<boost::mutex> lk(*m);
boost::this_thread::disable_interruption dc;
boost::this_thread::interruption_point();
*failed=false;
@@ -111,7 +111,7 @@
{
boost::mutex m;
bool failed=true;
- boost::mutex::scoped_lock lk(m);
+ boost::unique_lock<boost::mutex> lk(m);
boost::thread thrd(boost::bind(&disabled_interruption_point_thread,&m,&failed));
thrd.interrupt();
lk.unlock();
@@ -165,7 +165,7 @@
void operator()()
{
- boost::mutex::scoped_lock lk(mut);
+ boost::unique_lock<boost::mutex> lk(mut);
while(!done)
{
cond.wait(lk);
@@ -184,7 +184,7 @@
BOOST_CHECK(!joined);
BOOST_CHECK(thrd.joinable());
{
- boost::mutex::scoped_lock lk(f.mut);
+ boost::unique_lock<boost::mutex> lk(f.mut);
f.done=true;
f.cond.notify_one();
}
Modified: trunk/libs/thread/test/test_thread_launching.cpp
==============================================================================
--- trunk/libs/thread/test/test_thread_launching.cpp (original)
+++ trunk/libs/thread/test/test_thread_launching.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -2,6 +2,9 @@
//
// 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)
+
+#define BOOST_THREAD_VERSION 3
+
#include <boost/thread/thread.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/ref.hpp>
Modified: trunk/libs/thread/test/test_thread_mf.cpp
==============================================================================
--- trunk/libs/thread/test/test_thread_mf.cpp (original)
+++ trunk/libs/thread/test/test_thread_mf.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -5,6 +5,7 @@
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
+#define BOOST_THREAD_VERSION 3
#include <boost/thread/thread.hpp>
#include <boost/detail/lightweight_test.hpp>
Modified: trunk/libs/thread/test/test_tss.cpp
==============================================================================
--- trunk/libs/thread/test/test_tss.cpp (original)
+++ trunk/libs/thread/test/test_tss.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -34,14 +34,14 @@
{
tss_value_t()
{
- boost::mutex::scoped_lock lock(tss_mutex);
+ boost::unique_lock<boost::mutex> lock(tss_mutex);
++tss_instances;
++tss_total;
value = 0;
}
~tss_value_t()
{
- boost::mutex::scoped_lock lock(tss_mutex);
+ boost::unique_lock<boost::mutex> lock(tss_mutex);
--tss_instances;
}
int value;
@@ -59,7 +59,7 @@
// be thread safe. Must evaluate further.
if (n != i)
{
- boost::mutex::scoped_lock lock(check_mutex);
+ boost::unique_lock<boost::mutex> lock(check_mutex);
BOOST_CHECK_EQUAL(n, i);
}
++n;
Modified: trunk/libs/thread/test/test_xtime.cpp
==============================================================================
--- trunk/libs/thread/test/test_xtime.cpp (original)
+++ trunk/libs/thread/test/test_xtime.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -88,7 +88,7 @@
boost::condition_variable_any cond_any;
boost::mutex m;
- boost::mutex::scoped_lock lk(m);
+ boost::unique_lock<boost::mutex> lk(m);
cond.timed_wait(lk,boost::get_xtime(boost::get_system_time()+boost::posix_time::milliseconds(10)));
cond.timed_wait(lk,boost::get_xtime(boost::get_system_time()+boost::posix_time::milliseconds(10)),predicate);
cond_any.timed_wait(lk,boost::get_xtime(boost::get_system_time()+boost::posix_time::milliseconds(10)));
Modified: trunk/libs/thread/test/threads/container/thread_ptr_list_pass.cpp
==============================================================================
--- trunk/libs/thread/test/threads/container/thread_ptr_list_pass.cpp (original)
+++ trunk/libs/thread/test/threads/container/thread_ptr_list_pass.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -33,7 +33,7 @@
void increment_count()
{
- boost::mutex::scoped_lock lock(mutex);
+ boost::unique_lock<boost::mutex> lock(mutex);
std::cout << "count = " << ++count << std::endl;
}
Modified: trunk/libs/thread/test/threads/container/thread_vector_pass.cpp
==============================================================================
--- trunk/libs/thread/test/threads/container/thread_vector_pass.cpp (original)
+++ trunk/libs/thread/test/threads/container/thread_vector_pass.cpp 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -40,7 +40,7 @@
void increment_count()
{
- boost::mutex::scoped_lock lock(mutex);
+ boost::unique_lock<boost::mutex> lock(mutex);
std::cout << "count = " << ++count << std::endl;
}
Modified: trunk/libs/thread/test/util.inl
==============================================================================
--- trunk/libs/thread/test/util.inl (original)
+++ trunk/libs/thread/test/util.inl 2012-11-10 05:25:33 EST (Sat, 10 Nov 2012)
@@ -74,7 +74,7 @@
void start()
{
if (type != use_sleep_only) {
- boost::mutex::scoped_lock lock(mutex); done = false;
+ boost::unique_lock<boost::mutex> lock(mutex); done = false;
} else {
done = false;
}
@@ -82,7 +82,7 @@
void finish()
{
if (type != use_sleep_only) {
- boost::mutex::scoped_lock lock(mutex);
+ boost::unique_lock<boost::mutex> lock(mutex);
done = true;
if (type == use_condition)
cond.notify_one();
@@ -96,7 +96,7 @@
if (type != use_condition)
boost::thread::sleep(xt);
if (type != use_sleep_only) {
- boost::mutex::scoped_lock lock(mutex);
+ boost::unique_lock<boost::mutex> lock(mutex);
while (type == use_condition && !done) {
if (!cond.timed_wait(lock, xt))
break;
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