|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77939 - in trunk/boost/thread: . detail
From: vicente.botet_at_[hidden]
Date: 2012-04-12 16:32:21
Author: viboes
Date: 2012-04-12 16:32:20 EDT (Thu, 12 Apr 2012)
New Revision: 77939
URL: http://svn.boost.org/trac/boost/changeset/77939
Log:
Thread: Make use of the new macros to reduce the code duplication
Text files modified:
trunk/boost/thread/detail/move.hpp | 4
trunk/boost/thread/detail/thread.hpp | 14
trunk/boost/thread/future.hpp | 321 ++++-----------
trunk/boost/thread/locks.hpp | 794 +++++++++------------------------------
4 files changed, 287 insertions(+), 846 deletions(-)
Modified: trunk/boost/thread/detail/move.hpp
==============================================================================
--- trunk/boost/thread/detail/move.hpp (original)
+++ trunk/boost/thread/detail/move.hpp 2012-04-12 16:32:20 EDT (Thu, 12 Apr 2012)
@@ -63,12 +63,14 @@
#if ! defined BOOST_NO_RVALUE_REFERENCES
#define BOOST_THREAD_RV_REF(TYPE) BOOST_RV_REF(TYPE)
+#define BOOST_THREAD_RV(V) V
#define BOOST_THREAD_MAKE_RV_REF(RVALUE) RVALUE
#define BOOST_THREAD_FWD_REF(TYPE) BOOST_FWD_REF(TYPE)
#elif ! defined BOOST_NO_RVALUE_REFERENCES && defined BOOST_MSVC
#define BOOST_THREAD_RV_REF(TYPE) BOOST_RV_REF(TYPE)
+#define BOOST_THREAD_RV(V) V
#define BOOST_THREAD_MAKE_RV_REF(RVALUE) RVALUE
#define BOOST_THREAD_FWD_REF(TYPE) BOOST_FWD_REF(TYPE)
@@ -76,11 +78,13 @@
#if defined BOOST_THREAD_USES_MOVE
#define BOOST_THREAD_RV_REF(TYPE) BOOST_RV_REF(TYPE)
+#define BOOST_THREAD_RV(V) V
#define BOOST_THREAD_FWD_REF(TYPE) BOOST_FWD_REF(TYPE)
#else
#define BOOST_THREAD_RV_REF(TYPE) thread_move_t<TYPE>
+#define BOOST_THREAD_RV(V) (*V)
#define BOOST_THREAD_FWD_REF(TYPE) BOOST_FWD_REF(TYPE)
#endif
Modified: trunk/boost/thread/detail/thread.hpp
==============================================================================
--- trunk/boost/thread/detail/thread.hpp (original)
+++ trunk/boost/thread/detail/thread.hpp 2012-04-12 16:32:20 EDT (Thu, 12 Apr 2012)
@@ -265,21 +265,11 @@
start_thread(attrs);
}
-#if defined BOOST_THREAD_USES_MOVE
-
thread(BOOST_THREAD_RV_REF(thread) x)
{
- thread_info=x.thread_info;
- x.thread_info.reset();
+ thread_info=BOOST_THREAD_RV(x).thread_info;
+ BOOST_THREAD_RV(x).thread_info.reset();
}
-#else
-
- thread(BOOST_THREAD_RV_REF(thread) x)
- {
- thread_info=x->thread_info;
- x->thread_info.reset();
- }
-#endif
#if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100)
thread& operator=(thread x)
Modified: trunk/boost/thread/future.hpp
==============================================================================
--- trunk/boost/thread/future.hpp (original)
+++ trunk/boost/thread/future.hpp 2012-04-12 16:32:20 EDT (Thu, 12 Apr 2012)
@@ -366,17 +366,17 @@
#ifndef BOOST_NO_RVALUE_REFERENCES
typedef T const& source_reference_type;
struct dummy;
- typedef typename boost::mpl::if_<boost::is_fundamental<T>,dummy&,T&&>::type rvalue_source_type;
- typedef typename boost::mpl::if_<boost::is_fundamental<T>,T,T&&>::type move_dest_type;
+ typedef typename boost::mpl::if_<boost::is_fundamental<T>,dummy&,BOOST_THREAD_RV_REF(T)>::type rvalue_source_type;
+ typedef typename boost::mpl::if_<boost::is_fundamental<T>,T,BOOST_THREAD_RV_REF(T)>::type move_dest_type;
#else
#if defined BOOST_THREAD_USES_MOVE
typedef T& source_reference_type;
- typedef typename boost::mpl::if_<boost::has_move_emulation_enabled<T>,::boost::rv<T>&,T const&>::type rvalue_source_type;
- typedef typename boost::mpl::if_<boost::has_move_emulation_enabled<T>,::boost::rv<T>&,T>::type move_dest_type;
+ typedef typename boost::mpl::if_<boost::has_move_emulation_enabled<T>,BOOST_THREAD_RV_REF(T),T const&>::type rvalue_source_type;
+ typedef typename boost::mpl::if_<boost::has_move_emulation_enabled<T>,BOOST_THREAD_RV_REF(T),T>::type move_dest_type;
#else
typedef T& source_reference_type;
- typedef typename boost::mpl::if_<boost::is_convertible<T&,boost::detail::thread_move_t<T> >,boost::detail::thread_move_t<T>,T const&>::type rvalue_source_type;
- typedef typename boost::mpl::if_<boost::is_convertible<T&,boost::detail::thread_move_t<T> >,boost::detail::thread_move_t<T>,T>::type move_dest_type;
+ typedef typename boost::mpl::if_<boost::is_convertible<T&,BOOST_THREAD_RV_REF(T) >,BOOST_THREAD_RV_REF(T),T const&>::type rvalue_source_type;
+ typedef typename boost::mpl::if_<boost::is_convertible<T&,BOOST_THREAD_RV_REF(T) >,BOOST_THREAD_RV_REF(T),T>::type move_dest_type;
#endif
#endif
typedef const T& shared_future_get_result_type;
@@ -458,6 +458,7 @@
future_traits<T>::init(result,result_);
mark_finished_internal();
}
+
void mark_finished_with_result_internal(rvalue_source_type result_)
{
future_traits<T>::init(result,static_cast<rvalue_source_type>(result_));
@@ -469,28 +470,18 @@
boost::lock_guard<boost::mutex> lock(mutex);
mark_finished_with_result_internal(result_);
}
+
void mark_finished_with_result(rvalue_source_type result_)
{
boost::lock_guard<boost::mutex> lock(mutex);
-#if defined BOOST_THREAD_USES_MOVEXX
- mark_finished_with_result_internal(static_cast<rvalue_source_type>(result_));
-#else
mark_finished_with_result_internal(result_);
-#endif
}
-#if defined BOOST_THREAD_USES_MOVEXX
- T& get()
- {
- wait();
- return *result; }
-#else
move_dest_type get()
{
wait();
return static_cast<move_dest_type>(*result);
}
-#endif
shared_future_get_result_type get_sh()
{
@@ -831,47 +822,31 @@
{}
#ifndef BOOST_NO_RVALUE_REFERENCES
- BOOST_THREAD_FUTURE(BOOST_THREAD_FUTURE && other) BOOST_NOEXCEPT
- {
- future_.swap(other.future_);
- }
- BOOST_THREAD_FUTURE& operator=(BOOST_THREAD_FUTURE && other) BOOST_NOEXCEPT
+ BOOST_THREAD_FUTURE(BOOST_THREAD_RV_REF(BOOST_THREAD_FUTURE) other) BOOST_NOEXCEPT
{
- future_=other.future_;
- other.future_.reset();
- return *this;
+ future_.swap(BOOST_THREAD_RV(other).future_);
}
-#else
-#if defined BOOST_THREAD_USES_MOVE
- BOOST_THREAD_FUTURE(boost::rv<BOOST_THREAD_FUTURE>& other) BOOST_NOEXCEPT:
- future_(other.future_)
+ BOOST_THREAD_FUTURE& operator=(BOOST_THREAD_RV_REF(BOOST_THREAD_FUTURE) other) BOOST_NOEXCEPT
{
- other.future_.reset();
- }
-
- BOOST_THREAD_FUTURE& operator=(boost::rv<BOOST_THREAD_FUTURE>& other) BOOST_NOEXCEPT
- {
- future_=other.future_;
- other.future_.reset();
+ future_=BOOST_THREAD_RV(other).future_;
+ BOOST_THREAD_RV(other).future_.reset();
return *this;
}
-
#else
- BOOST_THREAD_FUTURE(boost::detail::thread_move_t<BOOST_THREAD_FUTURE> other) BOOST_NOEXCEPT:
- future_(other->future_)
+ BOOST_THREAD_FUTURE(BOOST_THREAD_RV_REF(BOOST_THREAD_FUTURE) other) BOOST_NOEXCEPT:
+ future_(BOOST_THREAD_RV(other).future_)
{
- other->future_.reset();
+ BOOST_THREAD_RV(other).future_.reset();
}
- BOOST_THREAD_FUTURE& operator=(boost::detail::thread_move_t<BOOST_THREAD_FUTURE> other) BOOST_NOEXCEPT
+ BOOST_THREAD_FUTURE& operator=(BOOST_THREAD_RV_REF(BOOST_THREAD_FUTURE) other) BOOST_NOEXCEPT
{
- future_=other->future_;
- other->future_.reset();
+ future_=BOOST_THREAD_RV(other).future_;
+ BOOST_THREAD_RV(other).future_.reset();
return *this;
}
#endif
-#endif
shared_future<R> share()
{
return shared_future<R>(::boost::move(*this));
@@ -1015,80 +990,51 @@
return *this;
}
#ifndef BOOST_NO_RVALUE_REFERENCES
- shared_future(shared_future && other) BOOST_NOEXCEPT
+ shared_future(BOOST_THREAD_RV_REF(shared_future) other) BOOST_NOEXCEPT
{
- future_.swap(other.future_);
- }
- shared_future(BOOST_THREAD_FUTURE<R> && other) BOOST_NOEXCEPT
- {
- future_.swap(other.future_);
- }
- shared_future& operator=(shared_future && other) BOOST_NOEXCEPT
- {
- future_.swap(other.future_);
- other.future_.reset();
- return *this;
- }
- shared_future& operator=(BOOST_THREAD_FUTURE<R> && other) BOOST_NOEXCEPT
- {
- future_.swap(other.future_);
- other.future_.reset();
- return *this;
+ future_.swap(BOOST_THREAD_RV(other).future_);
}
-#else
-#if defined BOOST_THREAD_USES_MOVE
- shared_future(boost::rv<shared_future>& other) BOOST_NOEXCEPT :
- future_(other.future_)
+ shared_future(BOOST_THREAD_RV_REF(BOOST_THREAD_FUTURE<R>) other) BOOST_NOEXCEPT
{
- other.future_.reset();
+ future_.swap(BOOST_THREAD_RV(other).future_);
}
-// shared_future(const BOOST_THREAD_FUTURE<R> &) = delete;
- shared_future(boost::rv<BOOST_THREAD_FUTURE<R> >& other) BOOST_NOEXCEPT :
- future_(other.future_)
+ shared_future& operator=(BOOST_THREAD_RV_REF(shared_future) other) BOOST_NOEXCEPT
{
- other.future_.reset();
- }
- shared_future& operator=(boost::rv<shared_future>& other) BOOST_NOEXCEPT
- {
- future_.swap(other.future_);
- other.future_.reset();
+ future_.swap(BOOST_THREAD_RV(other).future_);
+ BOOST_THREAD_RV(other).future_.reset();
return *this;
}
- shared_future& operator=(boost::rv<BOOST_THREAD_FUTURE<R> >& other) BOOST_NOEXCEPT
+ shared_future& operator=(BOOST_THREAD_RV_REF(BOOST_THREAD_FUTURE<R>) other) BOOST_NOEXCEPT
{
- future_.swap(other.future_);
- other.future_.reset();
+ future_.swap(BOOST_THREAD_RV(other).future_);
+ BOOST_THREAD_RV(other).future_.reset();
return *this;
}
-
#else
-
- shared_future(boost::detail::thread_move_t<shared_future> other) BOOST_NOEXCEPT :
- future_(other->future_)
+ shared_future(BOOST_THREAD_RV_REF(shared_future) other) BOOST_NOEXCEPT :
+ future_(BOOST_THREAD_RV(other).future_)
{
- other->future_.reset();
+ BOOST_THREAD_RV(other).future_.reset();
}
-// shared_future(const BOOST_THREAD_FUTURE<R> &) = delete;
- shared_future(boost::detail::thread_move_t<BOOST_THREAD_FUTURE<R> > other) BOOST_NOEXCEPT :
- future_(other->future_)
+ shared_future(BOOST_THREAD_RV_REF(BOOST_THREAD_FUTURE<R>) other) BOOST_NOEXCEPT :
+ future_(BOOST_THREAD_RV(other).future_)
{
- other->future_.reset();
+ BOOST_THREAD_RV(other).future_.reset();
}
- shared_future& operator=(boost::detail::thread_move_t<shared_future> other) BOOST_NOEXCEPT
+ shared_future& operator=(BOOST_THREAD_RV_REF(shared_future) other) BOOST_NOEXCEPT
{
- future_.swap(other->future_);
- other->future_.reset();
+ future_.swap(BOOST_THREAD_RV(other).future_);
+ BOOST_THREAD_RV(other).future_.reset();
return *this;
}
- shared_future& operator=(boost::detail::thread_move_t<BOOST_THREAD_FUTURE<R> > other) BOOST_NOEXCEPT
+ shared_future& operator=(BOOST_THREAD_RV_REF(BOOST_THREAD_FUTURE<R>) other) BOOST_NOEXCEPT
{
- future_.swap(other->future_);
- other->future_.reset();
+ future_.swap(BOOST_THREAD_RV(other).future_);
+ BOOST_THREAD_RV(other).future_.reset();
return *this;
}
#endif
-#endif
void swap(shared_future& other) BOOST_NOEXCEPT
{
@@ -1245,20 +1191,20 @@
// Assignment
#ifndef BOOST_NO_RVALUE_REFERENCES
- promise(promise && rhs) BOOST_NOEXCEPT:
- future_obtained(rhs.future_obtained)
+ promise(BOOST_THREAD_RV_REF(promise) rhs) BOOST_NOEXCEPT:
+ future_obtained(BOOST_THREAD_RV(rhs).future_obtained)
{
- future_.swap(rhs.future_);
- rhs.future_.reset();
- rhs.future_obtained=false;
+ future_.swap(BOOST_THREAD_RV(rhs).future_);
+ BOOST_THREAD_RV(rhs).future_.reset();
+ BOOST_THREAD_RV(rhs).future_obtained=false;
}
- promise & operator=(promise&& rhs) BOOST_NOEXCEPT
+ promise & operator=(BOOST_THREAD_RV_REF(promise) rhs) BOOST_NOEXCEPT
{
#if defined BOOST_THREAD_PROMISE_LAZY
- future_.swap(rhs.future_);
- future_obtained=rhs.future_obtained;
- rhs.future_.reset();
- rhs.future_obtained=false;
+ future_.swap(BOOST_THREAD_RV(rhs).future_);
+ future_obtained=BOOST_THREAD_RV(rhs).future_obtained;
+ BOOST_THREAD_RV(rhs).future_.reset();
+ BOOST_THREAD_RV(rhs).future_obtained=false;
#else
promise(boost::move(rhs)).swap(*this);
#endif
@@ -1266,40 +1212,22 @@
return *this;
}
#else
-#if defined BOOST_THREAD_USES_MOVE
- promise(boost::rv<promise>& rhs) BOOST_NOEXCEPT :
- future_(rhs.future_),future_obtained(rhs.future_obtained)
+ promise(BOOST_THREAD_RV_REF(promise) rhs) BOOST_NOEXCEPT :
+ future_(BOOST_THREAD_RV(rhs).future_),future_obtained(BOOST_THREAD_RV(rhs).future_obtained)
{
- rhs.future_.reset();
- rhs.future_obtained=false;
+ BOOST_THREAD_RV(rhs).future_.reset();
+ BOOST_THREAD_RV(rhs).future_obtained=false;
}
- promise & operator=(boost::rv<promise>& rhs) BOOST_NOEXCEPT
+ promise & operator=(BOOST_THREAD_RV_REF(promise) rhs) BOOST_NOEXCEPT
{
- future_=rhs.future_;
- future_obtained=rhs.future_obtained;
- rhs.future_.reset();
- rhs.future_obtained=false;
- return *this;
- }
-
-#else
- promise(boost::detail::thread_move_t<promise> rhs) BOOST_NOEXCEPT:
- future_(rhs->future_),future_obtained(rhs->future_obtained)
- {
- rhs->future_.reset();
- rhs->future_obtained=false;
- }
- promise & operator=(boost::detail::thread_move_t<promise> rhs) BOOST_NOEXCEPT
- {
- future_=rhs->future_;
- future_obtained=rhs->future_obtained;
- rhs->future_.reset();
- rhs->future_obtained=false;
+ future_=BOOST_THREAD_RV(rhs).future_;
+ future_obtained=BOOST_THREAD_RV(rhs).future_obtained;
+ BOOST_THREAD_RV(rhs).future_.reset();
+ BOOST_THREAD_RV(rhs).future_obtained=false;
return *this;
}
#endif
-#endif
void swap(promise& other)
{
@@ -1423,57 +1351,39 @@
// Assignment
#ifndef BOOST_NO_RVALUE_REFERENCES
- promise(promise && rhs) BOOST_NOEXCEPT :
- future_obtained(rhs.future_obtained)
+ promise(BOOST_THREAD_RV_REF(promise) rhs) BOOST_NOEXCEPT :
+ future_obtained(BOOST_THREAD_RV(rhs).future_obtained)
{
- future_.swap(rhs.future_);
+ future_.swap(BOOST_THREAD_RV(rhs).future_);
// we need to release the future as shared_ptr doesn't implements move semantics
- rhs.future_.reset();
- rhs.future_obtained=false;
- }
- promise & operator=(promise&& rhs) BOOST_NOEXCEPT
- {
- future_.swap(rhs.future_);
- future_obtained=rhs.future_obtained;
- rhs.future_.reset();
- rhs.future_obtained=false;
- return *this;
- }
-#else
-#if defined BOOST_THREAD_USES_MOVE
- promise(boost::rv<promise>& rhs) BOOST_NOEXCEPT :
- future_(rhs.future_),future_obtained(rhs.future_obtained)
- {
- rhs.future_.reset();
- rhs.future_obtained=false;
+ BOOST_THREAD_RV(rhs).future_.reset();
+ BOOST_THREAD_RV(rhs).future_obtained=false;
}
- promise & operator=(boost::rv<promise>& rhs) BOOST_NOEXCEPT
+ promise & operator=(BOOST_THREAD_RV_REF(promise) rhs) BOOST_NOEXCEPT
{
- future_=rhs.future_;
- future_obtained=rhs.future_obtained;
- rhs.future_.reset();
- rhs.future_obtained=false;
+ future_.swap(BOOST_THREAD_RV(rhs).future_);
+ future_obtained=BOOST_THREAD_RV(rhs).future_obtained;
+ BOOST_THREAD_RV(rhs).future_.reset();
+ BOOST_THREAD_RV(rhs).future_obtained=false;
return *this;
}
-
#else
- promise(boost::detail::thread_move_t<promise> rhs) BOOST_NOEXCEPT :
- future_(rhs->future_),future_obtained(rhs->future_obtained)
+ promise(BOOST_THREAD_RV_REF(promise) rhs) BOOST_NOEXCEPT :
+ future_(BOOST_THREAD_RV(rhs).future_),future_obtained(BOOST_THREAD_RV(rhs).future_obtained)
{
- rhs->future_.reset();
- rhs->future_obtained=false;
+ BOOST_THREAD_RV(rhs).future_.reset();
+ BOOST_THREAD_RV(rhs).future_obtained=false;
}
- promise & operator=(boost::detail::thread_move_t<promise> rhs) BOOST_NOEXCEPT
+ promise & operator=(BOOST_THREAD_RV_REF(promise) rhs) BOOST_NOEXCEPT
{
- future_=rhs->future_;
- future_obtained=rhs->future_obtained;
- rhs->future_.reset();
- rhs->future_obtained=false;
+ future_=BOOST_THREAD_RV(rhs).future_;
+ future_obtained=BOOST_THREAD_RV(rhs).future_obtained;
+ BOOST_THREAD_RV(rhs).future_.reset();
+ BOOST_THREAD_RV(rhs).future_obtained=false;
return *this;
}
#endif
-#endif
void swap(promise& other)
{
@@ -1602,15 +1512,15 @@
f(f_)
{}
#ifndef BOOST_NO_RVALUE_REFERENCES
- task_object(F&& f_):
+ task_object(BOOST_THREAD_RV_REF(F) f_):
f(boost::forward<F>(f_))
{}
#elif defined BOOST_THREAD_USES_MOVE
- task_object(boost::rv<F>& f_):
+ task_object(BOOST_THREAD_RV_REF(F) f_):
f(boost::move(f_))
{}
#else
- task_object(boost::detail::thread_move_t<F> f_):
+ task_object(BOOST_THREAD_RV_REF(F) f_):
f(f_)
{}
#endif
@@ -1643,15 +1553,15 @@
f(f_)
{}
#ifndef BOOST_NO_RVALUE_REFERENCES
- task_object(F&& f_):
+ task_object(BOOST_THREAD_RV_REF(F) f_):
f(boost::forward<F>(f_))
{}
#elif defined BOOST_THREAD_USES_MOVE
- task_object(boost::rv<F>& f_):
- f(boost::forward<F>(f_))
+ task_object(BOOST_THREAD_RV_REF(F) f_):
+ f(boost::move(f_))
{}
#else
- task_object(boost::detail::thread_move_t<F> f_):
+ task_object(BOOST_THREAD_RV_REF(F) f_):
f(f_)
{}
#endif
@@ -1698,7 +1608,7 @@
{}
#ifndef BOOST_NO_RVALUE_REFERENCES
template <class F>
- explicit packaged_task(F&& f):
+ explicit packaged_task(BOOST_THREAD_RV_REF(F) f):
task(new detail::task_object<R,
typename remove_cv<typename remove_reference<F>::type>::type
>(boost::forward<F>(f))),future_obtained(false)
@@ -1710,12 +1620,12 @@
{}
#if defined BOOST_THREAD_USES_MOVE
template <class F>
- explicit packaged_task(boost::rv<F>& f):
+ explicit packaged_task(BOOST_THREAD_RV_REF(F) f):
task(new detail::task_object<R,F>(boost::move(f))),future_obtained(false)
{}
#else
template <class F>
- explicit packaged_task(boost::detail::thread_move_t<F> f):
+ explicit packaged_task(BOOST_THREAD_RV_REF(F) f):
task(new detail::task_object<R,F>(f)),future_obtained(false)
{}
#endif
@@ -1735,7 +1645,7 @@
}
#ifndef BOOST_NO_RVALUE_REFERENCES
template <class F, class Allocator>
- packaged_task(boost::allocator_arg_t, Allocator a, F&& f)
+ packaged_task(boost::allocator_arg_t, Allocator a, BOOST_THREAD_RV_REF(F) f)
{
typedef typename remove_cv<typename remove_reference<F>::type>::type FR;
typedef typename Allocator::template rebind<detail::task_object<R,FR> >::other A2;
@@ -1754,12 +1664,11 @@
typedef thread_detail::allocator_destructor<A2> D;
task = task_ptr(::new(a2.allocate(1)) detail::task_object<R,F>(f), D(a2, 1) );
- std::cout << __FILE__ ":"<<__LINE__<<std::endl;
future_obtained = false;
}
#if defined BOOST_THREAD_USES_MOVE
template <class F, class Allocator>
- packaged_task(boost::allocator_arg_t, Allocator a, boost::rv<F>& f)
+ packaged_task(boost::allocator_arg_t, Allocator a, BOOST_THREAD_RV_REF(F) f)
{
typedef typename Allocator::template rebind<detail::task_object<R,F> >::other A2;
A2 a2(a);
@@ -1770,13 +1679,13 @@
}
#else
template <class F, class Allocator>
- packaged_task(boost::allocator_arg_t, Allocator a, boost::detail::thread_move_t<F> f)
+ packaged_task(boost::allocator_arg_t, Allocator a, BOOST_THREAD_RV_REF(F) f)
{
typedef typename Allocator::template rebind<detail::task_object<R,F> >::other A2;
A2 a2(a);
typedef thread_detail::allocator_destructor<A2> D;
- task = task_ptr(::new(a2.allocate(1)) detail::task_object<R,F>(boost::forward<F>(f)), D(a2, 1) );
+ task = task_ptr(::new(a2.allocate(1)) detail::task_object<R,F>(f), D(a2, 1) );
future_obtained = false;
}
#endif // BOOST_THREAD_USES_MOVE
@@ -1792,50 +1701,18 @@
}
// assignment
-#ifndef BOOST_NO_RVALUE_REFERENCES
- packaged_task(packaged_task&& other) BOOST_NOEXCEPT :
- future_obtained(other.future_obtained)
+ packaged_task(BOOST_THREAD_RV_REF(packaged_task) other) BOOST_NOEXCEPT :
+ future_obtained(BOOST_THREAD_RV(other).future_obtained)
{
- task.swap(other.task);
- other.future_obtained=false;
+ task.swap(BOOST_THREAD_RV(other).task);
+ BOOST_THREAD_RV(other).future_obtained=false;
}
- packaged_task& operator=(packaged_task&& other) BOOST_NOEXCEPT
+ packaged_task& operator=(BOOST_THREAD_RV_REF(packaged_task) other) BOOST_NOEXCEPT
{
- packaged_task temp(static_cast<packaged_task&&>(other));
+ packaged_task temp(static_cast<BOOST_THREAD_RV_REF(packaged_task)>(other));
swap(temp);
return *this;
}
-#else
-#if defined BOOST_THREAD_USES_MOVE
- packaged_task(boost::rv<packaged_task>& other) BOOST_NOEXCEPT :
- future_obtained(other.future_obtained)
- {
- task.swap(other.task);
- other.future_obtained=false;
- }
- packaged_task& operator=(boost::rv<packaged_task>& other) BOOST_NOEXCEPT
- {
- packaged_task temp(other);
- swap(temp);
- return *this;
- }
-
-#else
- packaged_task(boost::detail::thread_move_t<packaged_task> other) BOOST_NOEXCEPT:
- future_obtained(other->future_obtained)
- {
- task.swap(other->task);
- other->future_obtained=false;
- }
- packaged_task& operator=(boost::detail::thread_move_t<packaged_task> other) BOOST_NOEXCEPT
- {
- packaged_task temp(other);
- swap(temp);
- return *this;
- }
-
-#endif
-#endif
void reset()
{
Modified: trunk/boost/thread/locks.hpp
==============================================================================
--- trunk/boost/thread/locks.hpp (original)
+++ trunk/boost/thread/locks.hpp 2012-04-12 16:32:20 EDT (Thu, 12 Apr 2012)
@@ -334,16 +334,16 @@
#endif
#ifndef BOOST_NO_RVALUE_REFERENCES
- unique_lock(unique_lock&& other) BOOST_NOEXCEPT:
- m(other.m),is_locked(other.is_locked)
+ unique_lock(BOOST_THREAD_RV_REF(unique_lock) other) BOOST_NOEXCEPT:
+ m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked)
{
- other.is_locked=false;
- other.m=0;
+ BOOST_THREAD_RV(other).is_locked=false;
+ BOOST_THREAD_RV(other).m=0;
}
- BOOST_THREAD_EXPLICIT_LOCK_CONVERSION unique_lock(upgrade_lock<Mutex>&& other);
+ BOOST_THREAD_EXPLICIT_LOCK_CONVERSION unique_lock(BOOST_THREAD_RV_REF(upgrade_lock<Mutex>) other);
- unique_lock& operator=(unique_lock&& other) BOOST_NOEXCEPT
+ unique_lock& operator=(BOOST_THREAD_RV_REF(unique_lock) other) BOOST_NOEXCEPT
{
unique_lock temp(::boost::move(other));
swap(temp);
@@ -351,454 +351,268 @@
}
#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
- unique_lock& operator=(upgrade_lock<Mutex>&& other) BOOST_NOEXCEPT
+ unique_lock& operator=(BOOST_THREAD_RV_REF(upgrade_lock<Mutex>) other) BOOST_NOEXCEPT
{
unique_lock temp(::boost::move(other));
swap(temp);
return *this;
}
#endif
-#else
-#if defined BOOST_THREAD_USES_MOVE
- unique_lock(boost::rv<unique_lock<Mutex> >& other) BOOST_NOEXCEPT:
- m(other.m),is_locked(other.is_locked)
+#else // BOOST_NO_RVALUE_REFERENCES
+ unique_lock(BOOST_THREAD_RV_REF(unique_lock<Mutex>) other) BOOST_NOEXCEPT:
+ m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked)
{
- other.is_locked=false;
- other.m=0;
+ BOOST_THREAD_RV(other).is_locked=false;
+ BOOST_THREAD_RV(other).m=0;
}
- BOOST_THREAD_EXPLICIT_LOCK_CONVERSION unique_lock(boost::rv<upgrade_lock<Mutex> >& other);
-
-// //operator boost::rv<boost::unique_lock<boost::mutex> >&
-// operator boost::rv<unique_lock<Mutex> >&()
-// {
-// return *static_cast< ::boost::rv<unique_lock<Mutex> >* >(this);
-// }
-// operator const ::boost::rv<unique_lock<Mutex> >&() const
-// {
-// return *static_cast<const ::boost::rv<unique_lock<Mutex> >* >(this);
-// }
-// ::boost::rv<unique_lock<Mutex> >& move()
-// {
-// return *static_cast< ::boost::rv<unique_lock<Mutex> >* >(this);
-// }
-// const ::boost::rv<unique_lock<Mutex> >& move() const
-// {
-// return *static_cast<const ::boost::rv<unique_lock<Mutex> >* >(this);
-// }
+ BOOST_THREAD_EXPLICIT_LOCK_CONVERSION unique_lock(BOOST_THREAD_RV_REF(upgrade_lock<Mutex>) other);
#if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100)
unique_lock& operator=(unique_lock<Mutex> other)
{
swap(other);
return *this;
}
-#else
- unique_lock& operator=(boost::rv<unique_lock<Mutex> >& other) BOOST_NOEXCEPT
+#else // BOOST_WORKAROUND
+ unique_lock& operator=(BOOST_THREAD_RV_REF(unique_lock<Mutex>) other) BOOST_NOEXCEPT
{
unique_lock temp(other);
swap(temp);
return *this;
}
-#endif
-
+#endif // BOOST_WORKAROUND
#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
- unique_lock& operator=(boost::rv<upgrade_lock<Mutex> >& other) BOOST_NOEXCEPT
+ unique_lock& operator=(BOOST_THREAD_RV_REF(upgrade_lock<Mutex>) other) BOOST_NOEXCEPT
{
unique_lock temp(other);
swap(temp);
return *this;
}
-#endif
-#else
- unique_lock(detail::thread_move_t<unique_lock<Mutex> > other) BOOST_NOEXCEPT:
- m(other->m),is_locked(other->is_locked)
- {
- other->is_locked=false;
- other->m=0;
- }
- BOOST_THREAD_EXPLICIT_LOCK_CONVERSION unique_lock(detail::thread_move_t<upgrade_lock<Mutex> > other);
-
-// operator detail::thread_move_t<unique_lock<Mutex> >()
-// {
-// return move();
-// }
-//
-// detail::thread_move_t<unique_lock<Mutex> > move()
-// {
-// return detail::thread_move_t<unique_lock<Mutex> >(*this);
-// }
-
-#if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100)
- unique_lock& operator=(unique_lock<Mutex> other)
- {
- swap(other);
- return *this;
- }
-#else
- unique_lock& operator=(detail::thread_move_t<unique_lock<Mutex> > other) BOOST_NOEXCEPT
- {
- unique_lock temp(other);
- swap(temp);
- return *this;
- }
-#endif
-
-#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
- unique_lock& operator=(detail::thread_move_t<upgrade_lock<Mutex> > other) BOOST_NOEXCEPT
- {
- unique_lock temp(other);
- swap(temp);
- return *this;
- }
-#endif
-
- void swap(detail::thread_move_t<unique_lock<Mutex> > other) BOOST_NOEXCEPT
- {
- std::swap(m,other->m);
- std::swap(is_locked,other->is_locked);
- }
-#endif
-#endif
+#endif // BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
+#endif // BOOST_NO_RVALUE_REFERENCES
#ifndef BOOST_NO_RVALUE_REFERENCES
// Conversion from upgrade locking
- unique_lock(upgrade_lock<mutex_type>&& ul, try_to_lock_t)
+ unique_lock(BOOST_THREAD_RV_REF(upgrade_lock<mutex_type>) ul, try_to_lock_t)
: m(0),is_locked(false)
{
- if (ul.owns_lock()) {
- if (ul.mutex()->try_unlock_upgrade_and_lock())
+ if (BOOST_THREAD_RV(ul).owns_lock()) {
+ if (BOOST_THREAD_RV(ul).mutex()->try_unlock_upgrade_and_lock())
{
- m = ul.release();
+ m = BOOST_THREAD_RV(ul).release();
is_locked = true;
}
}
else
{
- m = ul.release();
+ m = BOOST_THREAD_RV(ul).release();
}
}
#ifdef BOOST_THREAD_USES_CHRONO
template <class Clock, class Duration>
- unique_lock(upgrade_lock<mutex_type>&& ul,
+ unique_lock(BOOST_THREAD_RV_REF(upgrade_lock<mutex_type>) ul,
const chrono::time_point<Clock, Duration>& abs_time)
: m(0),is_locked(false)
{
- if (ul.owns_lock()) {
- if (ul.mutex()->try_unlock_upgrade_and_lock_until(abs_time))
+ if (BOOST_THREAD_RV(ul).owns_lock()) {
+ if (BOOST_THREAD_RV(ul).mutex()->try_unlock_upgrade_and_lock_until(abs_time))
{
- m = ul.release();
+ m = BOOST_THREAD_RV(ul).release();
is_locked = true;
}
}
else
{
- m = ul.release();
+ m = BOOST_THREAD_RV(ul).release();
}
}
template <class Rep, class Period>
- unique_lock(upgrade_lock<mutex_type>&& ul,
+ unique_lock(BOOST_THREAD_RV_REF(upgrade_lock<mutex_type>) ul,
const chrono::duration<Rep, Period>& rel_time)
: m(0),is_locked(false)
{
- if (ul.owns_lock()) {
- if (ul.mutex()->try_unlock_upgrade_and_lock_for(rel_time))
+ if (BOOST_THREAD_RV(ul).owns_lock()) {
+ if (BOOST_THREAD_RV(ul).mutex()->try_unlock_upgrade_and_lock_for(rel_time))
{
- m = ul.release();
+ m = BOOST_THREAD_RV(ul).release();
is_locked = true;
}
}
else
{
- m = ul.release();
+ m = BOOST_THREAD_RV(ul).release();
}
}
#endif
#else
-#if defined BOOST_THREAD_USES_MOVE
// Conversion from upgrade locking
- unique_lock(boost::rv<upgrade_lock<mutex_type> > &ul, try_to_lock_t)
+ unique_lock(BOOST_THREAD_RV_REF(upgrade_lock<mutex_type>) ul, try_to_lock_t)
: m(0),is_locked(false)
{
- if (ul.owns_lock()) {
- if (ul.mutex()->try_unlock_upgrade_and_lock())
+ if (BOOST_THREAD_RV(ul).owns_lock()) {
+ if (BOOST_THREAD_RV(ul).mutex()->try_unlock_upgrade_and_lock())
{
- m = ul.release();
+ m = BOOST_THREAD_RV(ul).release();
is_locked = true;
}
}
else
{
- m = ul.release();
- }
- }
-#ifdef BOOST_THREAD_USES_CHRONO
- template <class Clock, class Duration>
- unique_lock(boost::rv<upgrade_lock<mutex_type> > &ul,
- const chrono::time_point<Clock, Duration>& abs_time)
- : m(0),is_locked(false)
- {
- if (ul.owns_lock()) {
- if (ul.mutex()->try_unlock_upgrade_and_lock_until(abs_time))
- {
- m = ul.release();
- is_locked = true;
- }
- }
- else
- {
- m = ul.release();
+ m = BOOST_THREAD_RV(ul).release();
}
}
- template <class Rep, class Period>
- unique_lock(boost::rv<upgrade_lock<mutex_type> > &ul,
- const chrono::duration<Rep, Period>& rel_time)
- : m(0),is_locked(false)
- {
- if (ul.owns_lock()) {
- if (ul.mutex()->try_unlock_upgrade_and_lock_for(rel_time))
- {
- m = ul.release();
- is_locked = true;
- }
- }
- else
- {
- m = ul.release();
- }
- }
-#endif
-#else
- // Conversion from upgrade locking
- unique_lock(detail::thread_move_t<upgrade_lock<mutex_type> > ul, try_to_lock_t)
- : m(0),is_locked(false)
- {
- if (ul.owns_lock()) {
- if (ul.mutex()->try_unlock_upgrade_and_lock())
- {
- m = ul.release();
- is_locked = true;
- }
- }
- else
- {
- m = ul.release();
- }
- }
#ifdef BOOST_THREAD_USES_CHRONO
template <class Clock, class Duration>
- unique_lock(detail::thread_move_t<upgrade_lock<mutex_type> > ul,
+ unique_lock(BOOST_THREAD_RV_REF(upgrade_lock<mutex_type>) ul,
const chrono::time_point<Clock, Duration>& abs_time)
: m(0),is_locked(false)
{
- if (ul.owns_lock()) {
- if (ul.mutex()->try_unlock_upgrade_and_lock_until(abs_time))
+ if (BOOST_THREAD_RV(ul).owns_lock()) {
+ if (BOOST_THREAD_RV(ul).mutex()->try_unlock_upgrade_and_lock_until(abs_time))
{
- m = ul.release();
+ m = BOOST_THREAD_RV(ul).release();
is_locked = true;
}
}
else
{
- m = ul.release();
+ m = BOOST_THREAD_RV(ul).release();
}
}
-
template <class Rep, class Period>
- unique_lock(detail::thread_move_t<upgrade_lock<mutex_type> > ul,
+ unique_lock(BOOST_THREAD_RV_REF(upgrade_lock<mutex_type>) ul,
const chrono::duration<Rep, Period>& rel_time)
: m(0),is_locked(false)
{
- if (ul.owns_lock()) {
- if (ul.mutex()->try_unlock_upgrade_and_lock_for(rel_time))
+ if (BOOST_THREAD_RV(ul).owns_lock()) {
+ if (BOOST_THREAD_RV(ul).mutex()->try_unlock_upgrade_and_lock_for(rel_time))
{
- m = ul.release();
+ m = BOOST_THREAD_RV(ul).release();
is_locked = true;
}
}
else
{
- m = ul.release();
+ m = BOOST_THREAD_RV(ul).release();
}
}
#endif
#endif
-#endif
#ifdef BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS
#ifndef BOOST_NO_RVALUE_REFERENCES
// Conversion from shared locking
- unique_lock(shared_lock<mutex_type>&& sl, try_to_lock_t)
+ unique_lock(BOOST_THREAD_RV_REF(shared_lock<mutex_type>) sl, try_to_lock_t)
: m(0),is_locked(false)
{
- if (sl.owns_lock()) {
- if (sl.mutex()->try_unlock_shared_and_lock())
+ if (BOOST_THREAD_RV(sl).owns_lock()) {
+ if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock())
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
is_locked = true;
}
}
else
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
}
}
#ifdef BOOST_THREAD_USES_CHRONO
template <class Clock, class Duration>
- unique_lock(shared_lock<mutex_type>&& sl,
+ unique_lock(BOOST_THREAD_RV_REF(shared_lock<mutex_type>) sl,
const chrono::time_point<Clock, Duration>& abs_time)
: m(0),is_locked(false)
{
- if (sl.owns_lock()) {
- if (sl.mutex()->try_unlock_shared_and_lock_until(abs_time))
+ if (BOOST_THREAD_RV(sl).owns_lock()) {
+ if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock_until(abs_time))
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
is_locked = true;
}
}
else
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
}
}
template <class Rep, class Period>
- unique_lock(shared_lock<mutex_type>&& sl,
+ unique_lock(BOOST_THREAD_RV_REF(shared_lock<mutex_type>) sl,
const chrono::duration<Rep, Period>& rel_time)
: m(0),is_locked(false)
{
- if (sl.owns_lock()) {
- if (sl.mutex()->try_unlock_shared_and_lock_for(rel_time))
+ if (BOOST_THREAD_RV(sl).owns_lock()) {
+ if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock_for(rel_time))
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
is_locked = true;
}
}
else
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
}
}
#endif
#else
-
-#if defined BOOST_THREAD_USES_MOVE
-
// Conversion from shared locking
- unique_lock(boost::rv<shared_lock<mutex_type> >& sl, try_to_lock_t)
+ unique_lock(BOOST_THREAD_RV_REF(shared_lock<mutex_type>) sl, try_to_lock_t)
: m(0),is_locked(false)
{
- if (sl.owns_lock()) {
- if (sl.mutex()->try_unlock_shared_and_lock())
+ if (BOOST_THREAD_RV(sl).owns_lock()) {
+ if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock())
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
is_locked = true;
}
}
else
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
}
}
#ifdef BOOST_THREAD_USES_CHRONO
template <class Clock, class Duration>
- unique_lock(boost::rv<shared_lock<mutex_type> >& sl,
+ unique_lock(BOOST_THREAD_RV_REF(shared_lock<mutex_type>) sl,
const chrono::time_point<Clock, Duration>& abs_time)
: m(0),is_locked(false)
{
- if (sl.owns_lock()) {
- if (sl.mutex()->try_unlock_shared_and_lock_until(abs_time))
+ if (BOOST_THREAD_RV(sl).owns_lock()) {
+ if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock_until(abs_time))
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
is_locked = true;
}
}
else
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
}
}
-
template <class Rep, class Period>
- unique_lock(boost::rv<shared_lock<mutex_type> >& sl,
+ unique_lock(BOOST_THREAD_RV_REF(shared_lock<mutex_type>) sl,
const chrono::duration<Rep, Period>& rel_time)
: m(0),is_locked(false)
{
- if (sl.owns_lock()) {
- if (sl.mutex()->try_unlock_shared_and_lock_for(rel_time))
+ if (BOOST_THREAD_RV(sl).owns_lock()) {
+ if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock_for(rel_time))
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
is_locked = true;
}
}
else
{
- m = sl.release();
- }
- }
-#endif
-#else
-
- // Conversion from shared locking
- unique_lock(detail::thread_move_t<shared_lock<mutex_type> > sl, try_to_lock_t)
- : m(0),is_locked(false)
- {
- if (sl.owns_lock()) {
- if (sl.mutex()->try_unlock_shared_and_lock())
- {
- m = sl.release();
- is_locked = true;
- }
- }
- else
- {
- m = sl.release();
- }
- }
-
-#ifdef BOOST_THREAD_USES_CHRONO
- template <class Clock, class Duration>
- unique_lock(detail::thread_move_t<shared_lock<mutex_type> > sl,
- const chrono::time_point<Clock, Duration>& abs_time)
- : m(0),is_locked(false)
- {
- if (sl.owns_lock()) {
- if (sl.mutex()->try_unlock_shared_and_lock_until(abs_time))
- {
- m = sl.release();
- is_locked = true;
- }
- }
- else
- {
- m = sl.release();
- }
- }
-
- template <class Rep, class Period>
- unique_lock(detail::thread_move_t<shared_lock<mutex_type> > sl,
- const chrono::duration<Rep, Period>& rel_time)
- : m(0),is_locked(false)
- {
- if (sl.owns_lock()) {
- if (sl.mutex()->try_unlock_shared_and_lock_for(rel_time))
- {
- m = sl.release();
- is_locked = true;
- }
- }
- else
- {
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
}
}
#endif
#endif
#endif
-#endif
void swap(unique_lock& other) BOOST_NOEXCEPT
@@ -1030,37 +844,37 @@
#endif
#ifndef BOOST_NO_RVALUE_REFERENCES
- shared_lock(shared_lock<Mutex> && other) BOOST_NOEXCEPT:
- m(other.m),is_locked(other.is_locked)
+ shared_lock(BOOST_THREAD_RV_REF(shared_lock<Mutex>) other) BOOST_NOEXCEPT:
+ m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked)
{
- other.is_locked=false;
- other.m=0;
+ BOOST_THREAD_RV(other).is_locked=false;
+ BOOST_THREAD_RV(other).m=0;
}
- BOOST_THREAD_EXPLICIT_LOCK_CONVERSION shared_lock(unique_lock<Mutex> && other):
- m(other.m),is_locked(other.is_locked)
+ BOOST_THREAD_EXPLICIT_LOCK_CONVERSION shared_lock(BOOST_THREAD_RV_REF(unique_lock<Mutex>) other):
+ m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked)
{
if(is_locked)
{
m->unlock_and_lock_shared();
}
- other.is_locked=false;
- other.m=0;
+ BOOST_THREAD_RV(other).is_locked=false;
+ BOOST_THREAD_RV(other).m=0;
}
- BOOST_THREAD_EXPLICIT_LOCK_CONVERSION shared_lock(upgrade_lock<Mutex> && other):
- m(other.m),is_locked(other.is_locked)
+ BOOST_THREAD_EXPLICIT_LOCK_CONVERSION shared_lock(BOOST_THREAD_RV_REF(upgrade_lock<Mutex>) other):
+ m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked)
{
if(is_locked)
{
m->unlock_upgrade_and_lock_shared();
}
- other.is_locked=false;
- other.m=0;
+ BOOST_THREAD_RV(other).is_locked=false;
+ BOOST_THREAD_RV(other).m=0;
}
- shared_lock& operator=(shared_lock<Mutex> && other) BOOST_NOEXCEPT
+ shared_lock& operator=(BOOST_THREAD_RV_REF(shared_lock<Mutex>) other) BOOST_NOEXCEPT
{
shared_lock temp(::boost::move(other));
swap(temp);
@@ -1068,14 +882,14 @@
}
#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
- shared_lock& operator=(unique_lock<Mutex> && other)
+ shared_lock& operator=(BOOST_THREAD_RV_REF(unique_lock<Mutex>) other)
{
shared_lock temp(::boost::move(other));
swap(temp);
return *this;
}
- shared_lock& operator=(upgrade_lock<Mutex> && other)
+ shared_lock& operator=(BOOST_THREAD_RV_REF(upgrade_lock<Mutex>) other)
{
shared_lock temp(::boost::move(other));
swap(temp);
@@ -1083,37 +897,35 @@
}
#endif
#else
-#if defined BOOST_THREAD_USES_MOVE
- shared_lock(boost::rv<shared_lock<Mutex> >& other) BOOST_NOEXCEPT:
- m(other.m),is_locked(other.is_locked)
+ shared_lock(BOOST_THREAD_RV_REF(shared_lock<Mutex>) other) BOOST_NOEXCEPT:
+ m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked)
{
- other.is_locked=false;
- other.m=0;
+ BOOST_THREAD_RV(other).is_locked=false;
+ BOOST_THREAD_RV(other).m=0;
}
-
- BOOST_THREAD_EXPLICIT_LOCK_CONVERSION shared_lock(boost::rv<unique_lock<Mutex> >& other):
- m(other.m),is_locked(other.is_locked)
+ BOOST_THREAD_EXPLICIT_LOCK_CONVERSION shared_lock(BOOST_THREAD_RV_REF(unique_lock<Mutex>) other):
+ m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked)
{
if(is_locked)
{
m->unlock_and_lock_shared();
}
- other.is_locked=false;
- other.m=0;
+ BOOST_THREAD_RV(other).is_locked=false;
+ BOOST_THREAD_RV(other).m=0;
}
- BOOST_THREAD_EXPLICIT_LOCK_CONVERSION shared_lock(boost::rv<upgrade_lock<Mutex> >& other):
- m(other.m),is_locked(other.is_locked)
+ BOOST_THREAD_EXPLICIT_LOCK_CONVERSION shared_lock(BOOST_THREAD_RV_REF(upgrade_lock<Mutex>) other):
+ m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked)
{
if(is_locked)
{
m->unlock_upgrade_and_lock_shared();
}
- other.is_locked=false;
- other.m=0;
+ BOOST_THREAD_RV(other).is_locked=false;
+ BOOST_THREAD_RV(other).m=0;
}
- shared_lock& operator=(::boost::rv<shared_lock<Mutex> >& other) BOOST_NOEXCEPT
+ shared_lock& operator=(BOOST_THREAD_RV_REF(shared_lock<Mutex>) other) BOOST_NOEXCEPT
{
shared_lock temp(other);
swap(temp);
@@ -1121,86 +933,21 @@
}
#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
- shared_lock& operator=(::boost::rv<unique_lock<Mutex> >& other)
+ shared_lock& operator=(BOOST_THREAD_RV_REF(unique_lock<Mutex>) other)
{
shared_lock temp(other);
swap(temp);
return *this;
}
- shared_lock& operator=(::boost::rv<upgrade_lock<Mutex> >& other)
- {
- shared_lock temp(other);
- swap(temp);
- return *this;
- }
-#endif
-#else
-
- shared_lock(detail::thread_move_t<shared_lock<Mutex> > other) BOOST_NOEXCEPT:
- m(other->m),is_locked(other->is_locked)
- {
- other->is_locked=false;
- other->m=0;
- }
-
- BOOST_THREAD_EXPLICIT_LOCK_CONVERSION shared_lock(detail::thread_move_t<unique_lock<Mutex> > other):
- m(other->m),is_locked(other->is_locked)
- {
- if(is_locked)
- {
- m->unlock_and_lock_shared();
- }
- other->is_locked=false;
- other->m=0;
- }
-
- BOOST_THREAD_EXPLICIT_LOCK_CONVERSION shared_lock(detail::thread_move_t<upgrade_lock<Mutex> > other):
- m(other->m),is_locked(other->is_locked)
- {
- if(is_locked)
- {
- m->unlock_upgrade_and_lock_shared();
- }
- other->is_locked=false;
- other->m=0;
- }
-
-// operator detail::thread_move_t<shared_lock<Mutex> >() BOOST_NOEXCEPT
-// {
-// return move();
-// }
-//
-// detail::thread_move_t<shared_lock<Mutex> > move() BOOST_NOEXCEPT
-// {
-// return detail::thread_move_t<shared_lock<Mutex> >(*this);
-// }
-
-
- shared_lock& operator=(detail::thread_move_t<shared_lock<Mutex> > other) BOOST_NOEXCEPT
+ shared_lock& operator=(BOOST_THREAD_RV_REF(upgrade_lock<Mutex>) other)
{
shared_lock temp(other);
swap(temp);
return *this;
}
-
-#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
- shared_lock& operator=(detail::thread_move_t<unique_lock<Mutex> > other)
- {
- shared_lock temp(other);
- swap(temp);
- return *this;
- }
-
- shared_lock& operator=(detail::thread_move_t<upgrade_lock<Mutex> > other)
- {
- shared_lock temp(other);
- swap(temp);
- return *this;
- }
-#endif
-#endif
-#endif
+#endif // BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
+#endif // BOOST_NO_RVALUE_REFERENCES
void swap(shared_lock& other) BOOST_NOEXCEPT
{
@@ -1408,25 +1155,25 @@
#endif
#ifndef BOOST_NO_RVALUE_REFERENCES
- upgrade_lock(upgrade_lock<Mutex>&& other) BOOST_NOEXCEPT:
- m(other.m),is_locked(other.is_locked)
+ upgrade_lock(BOOST_THREAD_RV_REF(upgrade_lock<Mutex>) other) BOOST_NOEXCEPT:
+ m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked)
{
- other.is_locked=false;
- other.m=0;
+ BOOST_THREAD_RV(other).is_locked=false;
+ BOOST_THREAD_RV(other).m=0;
}
- BOOST_THREAD_EXPLICIT_LOCK_CONVERSION upgrade_lock(unique_lock<Mutex>&& other):
- m(other.m),is_locked(other.is_locked)
+ BOOST_THREAD_EXPLICIT_LOCK_CONVERSION upgrade_lock(BOOST_THREAD_RV_REF(unique_lock<Mutex>) other):
+ m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked)
{
if(is_locked)
{
m->unlock_and_lock_upgrade();
}
- other.is_locked=false;
- other.m=0;
+ BOOST_THREAD_RV(other).is_locked=false;
+ BOOST_THREAD_RV(other).m=0;
}
- upgrade_lock& operator=(upgrade_lock<Mutex>&& other) BOOST_NOEXCEPT
+ upgrade_lock& operator=(BOOST_THREAD_RV_REF(upgrade_lock<Mutex>) other) BOOST_NOEXCEPT
{
upgrade_lock temp(::boost::move(other));
swap(temp);
@@ -1434,7 +1181,7 @@
}
#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
- upgrade_lock& operator=(unique_lock<Mutex>&& other)
+ upgrade_lock& operator=(BOOST_THREAD_RV_REF(unique_lock<Mutex>) other)
{
upgrade_lock temp(::boost::move(other));
swap(temp);
@@ -1442,26 +1189,23 @@
}
#endif
#else
-#if defined BOOST_THREAD_USES_MOVE
- upgrade_lock(boost::rv<upgrade_lock<Mutex> >& other) BOOST_NOEXCEPT:
- m(other.m),is_locked(other.is_locked)
+ upgrade_lock(BOOST_THREAD_RV_REF(upgrade_lock<Mutex>) other) BOOST_NOEXCEPT:
+ m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked)
{
- other.is_locked=false;
- other.m=0;
+ BOOST_THREAD_RV(other).is_locked=false;
+ BOOST_THREAD_RV(other).m=0;
}
-
- BOOST_THREAD_EXPLICIT_LOCK_CONVERSION upgrade_lock(boost::rv<unique_lock<Mutex> >& other):
- m(other.m),is_locked(other.is_locked)
+ BOOST_THREAD_EXPLICIT_LOCK_CONVERSION upgrade_lock(BOOST_THREAD_RV_REF(unique_lock<Mutex>) other):
+ m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked)
{
if(is_locked)
{
m->unlock_and_lock_upgrade();
}
- other.is_locked=false;
- other.m=0;
+ BOOST_THREAD_RV(other).is_locked=false;
+ BOOST_THREAD_RV(other).m=0;
}
-
- upgrade_lock& operator=(boost::rv<upgrade_lock<Mutex> >& other) BOOST_NOEXCEPT
+ upgrade_lock& operator=(BOOST_THREAD_RV_REF(upgrade_lock<Mutex>) other) BOOST_NOEXCEPT
{
upgrade_lock temp(other);
swap(temp);
@@ -1469,232 +1213,128 @@
}
#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
- upgrade_lock& operator=(boost::rv<unique_lock<Mutex> >& other)
+ upgrade_lock& operator=(BOOST_THREAD_RV_REF(unique_lock<Mutex>) other)
{
upgrade_lock temp(other);
swap(temp);
return *this;
}
#endif
-#else
- upgrade_lock(detail::thread_move_t<upgrade_lock<Mutex> > other) BOOST_NOEXCEPT:
- m(other->m),is_locked(other->is_locked)
- {
- other->is_locked=false;
- other->m=0;
- }
-
- BOOST_THREAD_EXPLICIT_LOCK_CONVERSION upgrade_lock(detail::thread_move_t<unique_lock<Mutex> > other):
- m(other->m),is_locked(other->is_locked)
- {
- if(is_locked)
- {
- m->unlock_and_lock_upgrade();
- }
- other->is_locked=false;
- other->m=0;
- }
-
-// operator detail::thread_move_t<upgrade_lock<Mutex> >() BOOST_NOEXCEPT
-// {
-// return move();
-// }
-//
-// detail::thread_move_t<upgrade_lock<Mutex> > move() BOOST_NOEXCEPT
-// {
-// return detail::thread_move_t<upgrade_lock<Mutex> >(*this);
-// }
-
-
- upgrade_lock& operator=(detail::thread_move_t<upgrade_lock<Mutex> > other) BOOST_NOEXCEPT
- {
- upgrade_lock temp(other);
- swap(temp);
- return *this;
- }
-
-#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
- upgrade_lock& operator=(detail::thread_move_t<unique_lock<Mutex> > other)
- {
- upgrade_lock temp(other);
- swap(temp);
- return *this;
- }
-#endif
-#endif
#endif
#ifdef BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS
#ifndef BOOST_NO_RVALUE_REFERENCES
// Conversion from shared locking
- upgrade_lock(shared_lock<mutex_type>&& sl, try_to_lock_t)
+ upgrade_lock(BOOST_THREAD_RV_REF(shared_lock<mutex_type>) sl, try_to_lock_t)
: m(0),is_locked(false)
{
- if (sl.owns_lock()) {
- if (sl.mutex()->try_unlock_shared_and_lock_upgrade())
+ if (BOOST_THREAD_RV(sl).owns_lock()) {
+ if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock_upgrade())
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
is_locked = true;
}
}
else
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
}
}
#ifdef BOOST_THREAD_USES_CHRONO
template <class Clock, class Duration>
- upgrade_lock(shared_lock<mutex_type>&& sl,
+ upgrade_lock(BOOST_THREAD_RV_REF(shared_lock<mutex_type>) sl,
const chrono::time_point<Clock, Duration>& abs_time)
: m(0),is_locked(false)
{
- if (sl.owns_lock()) {
- if (sl.mutex()->try_unlock_shared_and_lock_upgrade_until(abs_time))
+ if (BOOST_THREAD_RV(sl).owns_lock()) {
+ if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock_upgrade_until(abs_time))
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
is_locked = true;
}
}
else
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
}
}
template <class Rep, class Period>
- upgrade_lock(shared_lock<mutex_type>&& sl,
+ upgrade_lock(BOOST_THREAD_RV_REF(shared_lock<mutex_type>) sl,
const chrono::duration<Rep, Period>& rel_time)
: m(0),is_locked(false)
{
- if (sl.owns_lock()) {
- if (sl.mutex()->try_unlock_shared_and_lock_upgrade_for(rel_time))
+ if (BOOST_THREAD_RV(sl).owns_lock()) {
+ if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock_upgrade_for(rel_time))
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
is_locked = true;
}
}
else
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
}
}
-#endif
-#else
-
-
-#if defined BOOST_THREAD_USES_MOVE
+#endif // BOOST_THREAD_USES_CHRONO
+#else // BOOST_NO_RVALUE_REFERENCES
// Conversion from shared locking
-
- upgrade_lock(boost::rv<shared_lock<mutex_type> > &sl, try_to_lock_t)
- : m(0),is_locked(false)
- {
- if (sl.owns_lock()) {
- if (sl.mutex()->try_unlock_shared_and_lock_upgrade())
- {
- m = sl.release();
- is_locked = true;
- }
- }
- else
- {
- m = sl.release();
- }
- }
-#ifdef BOOST_THREAD_USES_CHRONO
- template <class Clock, class Duration>
- upgrade_lock(boost::rv<shared_lock<mutex_type> > &sl,
- const chrono::time_point<Clock, Duration>& abs_time)
+ upgrade_lock(BOOST_THREAD_RV_REF(shared_lock<mutex_type>) sl, try_to_lock_t)
: m(0),is_locked(false)
{
- if (sl.owns_lock()) {
- if (sl.mutex()->try_unlock_shared_and_lock_upgrade_until(abs_time))
+ if (BOOST_THREAD_RV(sl).owns_lock()) {
+ if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock_upgrade())
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
is_locked = true;
}
}
else
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
}
}
- template <class Rep, class Period>
- upgrade_lock(boost::rv<shared_lock<mutex_type> > &sl,
- const chrono::duration<Rep, Period>& rel_time)
- : m(0),is_locked(false)
- {
- if (sl.owns_lock()) {
- if (sl.mutex()->try_unlock_shared_and_lock_upgrade_for(rel_time))
- {
- m = sl.release();
- is_locked = true;
- }
- }
- else
- {
- m = sl.release();
- }
- }
-#endif
-#else
- // Conversion from shared locking
-
- upgrade_lock(detail::thread_move_t<shared_lock<mutex_type> > sl, try_to_lock_t)
- : m(0),is_locked(false)
- {
- if (sl.owns_lock()) {
- if (sl.mutex()->try_unlock_shared_and_lock_upgrade())
- {
- m = sl.release();
- is_locked = true;
- }
- }
- else
- {
- m = sl.release();
- }
- }
#ifdef BOOST_THREAD_USES_CHRONO
+
template <class Clock, class Duration>
- upgrade_lock(detail::thread_move_t<shared_lock<mutex_type> > sl,
+ upgrade_lock(BOOST_THREAD_RV_REF(shared_lock<mutex_type>)sl,
const chrono::time_point<Clock, Duration>& abs_time)
: m(0),is_locked(false)
{
- if (sl.owns_lock()) {
- if (sl.mutex()->try_unlock_shared_and_lock_upgrade_until(abs_time))
+ if (BOOST_THREAD_RV(sl).owns_lock()) {
+ if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock_upgrade_until(abs_time))
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
is_locked = true;
}
}
else
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
}
}
template <class Rep, class Period>
- upgrade_lock(detail::thread_move_t<shared_lock<mutex_type> >& sl,
+ upgrade_lock(BOOST_THREAD_RV_REF(shared_lock<mutex_type>)sl,
const chrono::duration<Rep, Period>& rel_time)
: m(0),is_locked(false)
{
- if (sl.owns_lock()) {
- if (sl.mutex()->try_unlock_shared_and_lock_upgrade_for(rel_time))
+ if (BOOST_THREAD_RV(sl).owns_lock()) {
+ if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock_upgrade_for(rel_time))
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
is_locked = true;
}
}
else
{
- m = sl.release();
+ m = BOOST_THREAD_RV(sl).release();
}
}
-#endif
-#endif
-#endif
-#endif
+#endif // BOOST_THREAD_USES_CHRONO
+#endif // BOOST_NO_RVALUE_REFERENCES
+#endif // BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS
void swap(upgrade_lock& other) BOOST_NOEXCEPT
{
@@ -1827,42 +1467,17 @@
#endif
-#ifndef BOOST_NO_RVALUE_REFERENCES
- template<typename Mutex>
- unique_lock<Mutex>::unique_lock(upgrade_lock<Mutex>&& other):
- m(other.m),is_locked(other.is_locked)
- {
- if(is_locked)
- {
- m->unlock_upgrade_and_lock();
- }
- other.release();
- }
-#else
-#if defined BOOST_THREAD_USES_MOVE
template<typename Mutex>
- unique_lock<Mutex>::unique_lock(boost::rv<upgrade_lock<Mutex> >& other):
- m(other.m),is_locked(other.is_locked)
+ unique_lock<Mutex>::unique_lock(BOOST_THREAD_RV_REF(upgrade_lock<Mutex>) other):
+ m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked)
{
if(is_locked)
{
m->unlock_upgrade_and_lock();
}
- other.release();
+ BOOST_THREAD_RV(other).release();
}
-#else
- template<typename Mutex>
- unique_lock<Mutex>::unique_lock(detail::thread_move_t<upgrade_lock<Mutex> > other):
- m(other->m),is_locked(other->is_locked)
- {
- if(is_locked)
- {
- m->unlock_upgrade_and_lock();
- }
- other.release();
- }
-#endif
-#endif
+
template <class Mutex>
class upgrade_to_unique_lock
{
@@ -1885,50 +1500,19 @@
}
}
-#ifndef BOOST_NO_RVALUE_REFERENCES
- upgrade_to_unique_lock(upgrade_to_unique_lock<Mutex>&& other) BOOST_NOEXCEPT:
- source(other.source),exclusive(::boost::move(other.exclusive))
- {
- other.source=0;
- }
-
- upgrade_to_unique_lock& operator=(upgrade_to_unique_lock<Mutex>&& other) BOOST_NOEXCEPT
- {
- upgrade_to_unique_lock temp(other);
- swap(temp);
- return *this;
- }
-#else
-#if defined BOOST_THREAD_USES_MOVE
- upgrade_to_unique_lock(boost::rv<upgrade_to_unique_lock<Mutex> >& other) BOOST_NOEXCEPT:
- source(other.source),exclusive(::boost::move(other.exclusive))
- {
- other.source=0;
- }
-
- upgrade_to_unique_lock& operator=(boost::rv<upgrade_to_unique_lock<Mutex> >& other) BOOST_NOEXCEPT
- {
- upgrade_to_unique_lock temp(other);
- swap(temp);
- return *this;
- }
-
-#else
- upgrade_to_unique_lock(detail::thread_move_t<upgrade_to_unique_lock<Mutex> > other) BOOST_NOEXCEPT:
- source(other->source),exclusive(::boost::move(other->exclusive))
+ upgrade_to_unique_lock(BOOST_THREAD_RV_REF(upgrade_to_unique_lock<Mutex>) other) BOOST_NOEXCEPT:
+ source(BOOST_THREAD_RV(other).source),exclusive(::boost::move(BOOST_THREAD_RV(other).exclusive))
{
- other->source=0;
+ BOOST_THREAD_RV(other).source=0;
}
- upgrade_to_unique_lock& operator=(detail::thread_move_t<upgrade_to_unique_lock<Mutex> > other) BOOST_NOEXCEPT
+ upgrade_to_unique_lock& operator=(BOOST_THREAD_RV_REF(upgrade_to_unique_lock<Mutex>) other) BOOST_NOEXCEPT
{
upgrade_to_unique_lock temp(other);
swap(temp);
return *this;
}
-#endif
-#endif
void swap(upgrade_to_unique_lock& other) BOOST_NOEXCEPT
{
std::swap(source,other.source);
@@ -1992,11 +1576,11 @@
base(m_,try_to_lock)
{}
#ifndef BOOST_NO_RVALUE_REFERENCES
- try_lock_wrapper(try_lock_wrapper&& other):
+ try_lock_wrapper(BOOST_THREAD_RV_REF(try_lock_wrapper) other):
base(::boost::move(other))
{}
- try_lock_wrapper& operator=(try_lock_wrapper<Mutex>&& other)
+ try_lock_wrapper& operator=(BOOST_THREAD_RV_REF(try_lock_wrapper<Mutex>) other)
{
try_lock_wrapper temp(::boost::move(other));
swap(temp);
@@ -2005,34 +1589,21 @@
#else
#if defined BOOST_THREAD_USES_MOVE
- try_lock_wrapper(boost::rv<try_lock_wrapper<Mutex> >& other):
+ try_lock_wrapper(BOOST_THREAD_RV_REF(try_lock_wrapper<Mutex>) other):
base(::boost::move(static_cast<base&>(other)))
{}
- try_lock_wrapper& operator=(boost::rv<try_lock_wrapper<Mutex> >& other)
- {
- try_lock_wrapper temp(other);
- swap(temp);
- return *this;
- }
-
#else
- try_lock_wrapper(detail::thread_move_t<try_lock_wrapper<Mutex> > other):
- base(detail::thread_move_t<base>(*other))
+ try_lock_wrapper(BOOST_THREAD_RV_REF(try_lock_wrapper<Mutex>) other):
+ base(BOOST_THREAD_RV_REF(base)(*other))
{}
-
- try_lock_wrapper& operator=(detail::thread_move_t<try_lock_wrapper<Mutex> > other)
+#endif
+ try_lock_wrapper& operator=(BOOST_THREAD_RV_REF(try_lock_wrapper<Mutex>) other)
{
try_lock_wrapper temp(other);
swap(temp);
return *this;
}
-
- void swap(detail::thread_move_t<try_lock_wrapper<Mutex> > other)
- {
- base::swap(*other);
- }
-#endif
#endif
void swap(try_lock_wrapper& other)
{
@@ -2560,7 +2131,6 @@
}
}
-
#include <boost/config/abi_suffix.hpp>
#endif
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