mirror of
https://github.com/boostorg/thread.git
synced 2026-02-22 03:42:07 +00:00
make polymorphic queues move operations only available if C++11 RVALE supported.
This commit is contained in:
@@ -45,24 +45,26 @@ namespace concurrent
|
||||
void close() { queue.close(); }
|
||||
|
||||
void push_back(const value_type& x) { queue.push_back(x); }
|
||||
void push_back(BOOST_THREAD_RV_REF(value_type) x) { queue.push_back(boost::forward<value_type>(x)); }
|
||||
|
||||
void pull_front(value_type& x) { queue.pull_front(x); };
|
||||
// enable_if is_nothrow_copy_movable<value_type>
|
||||
value_type pull_front() { return queue.pull_front(); }
|
||||
|
||||
queue_op_status try_push_back(const value_type& x) { return queue.try_push_back(x); }
|
||||
queue_op_status try_push_back(BOOST_THREAD_RV_REF(value_type) x) { return queue.try_push_back(boost::forward<value_type>(x)); }
|
||||
queue_op_status try_pull_front(value_type& x) { return queue.try_pull_front(x); }
|
||||
|
||||
queue_op_status nonblocking_push_back(const value_type& x) { return queue.nonblocking_push_back(x); }
|
||||
queue_op_status nonblocking_push_back(BOOST_THREAD_RV_REF(value_type) x) { return queue.nonblocking_push_back(boost::forward<value_type>(x)); }
|
||||
queue_op_status nonblocking_pull_front(value_type& x) { return queue.nonblocking_pull_front(x); }
|
||||
|
||||
queue_op_status wait_push_back(const value_type& x) { return queue.wait_push_back(x); }
|
||||
queue_op_status wait_push_back(BOOST_THREAD_RV_REF(value_type) x) { return queue.wait_push_back(boost::forward<value_type>(x)); }
|
||||
queue_op_status wait_pull_front(value_type& x) { return queue.wait_pull_front(x); }
|
||||
|
||||
#if ! defined BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
void push_back(BOOST_THREAD_RV_REF(value_type) x) { queue.push_back(boost::move(x)); }
|
||||
queue_op_status try_push_back(BOOST_THREAD_RV_REF(value_type) x) { return queue.try_push_back(boost::move(x)); }
|
||||
queue_op_status nonblocking_push_back(BOOST_THREAD_RV_REF(value_type) x) { return queue.nonblocking_push_back(boost::move(x)); }
|
||||
queue_op_status wait_push_back(BOOST_THREAD_RV_REF(value_type) x) { return queue.wait_push_back(boost::move(x)); }
|
||||
#endif
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -42,24 +42,26 @@ namespace concurrent
|
||||
virtual void close() = 0;
|
||||
|
||||
virtual void push_back(const value_type& x) = 0;
|
||||
virtual void push_back(BOOST_THREAD_RV_REF(value_type) x) = 0;
|
||||
|
||||
virtual void pull_front(value_type&) = 0;
|
||||
// enable_if is_nothrow_copy_movable<value_type>
|
||||
virtual value_type pull_front() = 0;
|
||||
|
||||
virtual queue_op_status try_push_back(const value_type& x) = 0;
|
||||
virtual queue_op_status try_push_back(BOOST_THREAD_RV_REF(value_type) x) = 0;
|
||||
virtual queue_op_status try_pull_front(value_type&) = 0;
|
||||
|
||||
virtual queue_op_status nonblocking_push_back(const value_type& x) = 0;
|
||||
virtual queue_op_status nonblocking_push_back(BOOST_THREAD_RV_REF(value_type) x) = 0;
|
||||
virtual queue_op_status nonblocking_pull_front(value_type&) = 0;
|
||||
|
||||
virtual queue_op_status wait_push_back(const value_type& x) = 0;
|
||||
virtual queue_op_status wait_push_back(BOOST_THREAD_RV_REF(value_type) x) = 0;
|
||||
virtual queue_op_status wait_pull_front(ValueType& elem) = 0;
|
||||
|
||||
#if ! defined BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
virtual void push_back(BOOST_THREAD_RV_REF(value_type) x) = 0;
|
||||
virtual queue_op_status try_push_back(BOOST_THREAD_RV_REF(value_type) x) = 0;
|
||||
virtual queue_op_status nonblocking_push_back(BOOST_THREAD_RV_REF(value_type) x) = 0;
|
||||
virtual queue_op_status wait_push_back(BOOST_THREAD_RV_REF(value_type) x) = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -44,26 +44,28 @@ namespace concurrent
|
||||
void close() { queue.close(); }
|
||||
|
||||
void push(const value_type& x) { queue.push_back(x); }
|
||||
void push(BOOST_THREAD_RV_REF(value_type) x) { queue.push_back(forward<value_type>(x)); }
|
||||
|
||||
void pull(value_type& x) { queue.pull_back(x); }
|
||||
// enable_if is_nothrow_copy_movable<value_type>
|
||||
value_type pull() { return queue.pull_back(); }
|
||||
|
||||
queue_op_status try_push(const value_type& x) { return queue.try_push_back(x); }
|
||||
queue_op_status try_push(BOOST_THREAD_RV_REF(value_type) x) { return queue.try_push_back(forward<value_type>(x)); }
|
||||
|
||||
queue_op_status try_pull(value_type& x) { return queue.try_pull_back(x); }
|
||||
|
||||
queue_op_status nonblocking_push(const value_type& x) { return queue.nonblocking_push_back(x); }
|
||||
queue_op_status nonblocking_push(BOOST_THREAD_RV_REF(value_type) x) { return queue.nonblocking_push_back(forward<value_type>(x)); }
|
||||
|
||||
queue_op_status nonblocking_pull(value_type& x) { return queue.nonblocking_pull_back(x); }
|
||||
|
||||
queue_op_status wait_push(const value_type& x) { return queue.wait_push_back(x); }
|
||||
queue_op_status wait_push(BOOST_THREAD_RV_REF(value_type) x) { return queue.wait_push_back(forward<value_type>(x)); }
|
||||
queue_op_status wait_pull_front(value_type& x) { return queue.wait_pull_back(x); }
|
||||
|
||||
#if ! defined BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
void push(BOOST_THREAD_RV_REF(value_type) x) { queue.push_back(boost::move(x)); }
|
||||
queue_op_status try_push(BOOST_THREAD_RV_REF(value_type) x) { return queue.try_push_back(boost::move(x)); }
|
||||
queue_op_status nonblocking_push(BOOST_THREAD_RV_REF(value_type) x) { return queue.nonblocking_push_back(boost::move(x)); }
|
||||
queue_op_status wait_push(BOOST_THREAD_RV_REF(value_type) x) { return queue.wait_push_back(boost::move(x)); }
|
||||
#endif
|
||||
};
|
||||
|
||||
template <typename Queue>
|
||||
@@ -87,25 +89,27 @@ namespace concurrent
|
||||
void close() { queue.close(); }
|
||||
|
||||
void push(const value_type& x) { queue.push_front(x); }
|
||||
void push(BOOST_THREAD_RV_REF(value_type) x) { queue.push_front(forward<value_type>(x)); }
|
||||
|
||||
void pull(value_type& x) { queue.pull_front(x); };
|
||||
// enable_if is_nothrow_copy_movable<value_type>
|
||||
value_type pull() { return queue.pull_front(); }
|
||||
|
||||
queue_op_status try_push(const value_type& x) { return queue.try_push_front(x); }
|
||||
queue_op_status try_push(BOOST_THREAD_RV_REF(value_type) x) { return queue.try_push_front(forward<value_type>(x)); }
|
||||
|
||||
queue_op_status try_pull(value_type& x) { return queue.try_pull_front(x); }
|
||||
|
||||
queue_op_status nonblocking_push(const value_type& x) { return queue.nonblocking_push_front(x); }
|
||||
queue_op_status nonblocking_push(BOOST_THREAD_RV_REF(value_type) x) { return queue.nonblocking_push_front(forward<value_type>(x)); }
|
||||
|
||||
queue_op_status nonblocking_pull(value_type& x) { return queue.nonblocking_pull_front(x); }
|
||||
|
||||
queue_op_status wait_push(const value_type& x) { return queue.wait_push_front(x); }
|
||||
queue_op_status wait_push(BOOST_THREAD_RV_REF(value_type) x) { return queue.wait_push_front(forward<value_type>(x)); }
|
||||
queue_op_status wait_pull(value_type& x) { return queue.wait_pull_front(x); }
|
||||
#if ! defined BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
void push(BOOST_THREAD_RV_REF(value_type) x) { queue.push_front(forward<value_type>(x)); }
|
||||
queue_op_status try_push(BOOST_THREAD_RV_REF(value_type) x) { return queue.try_push_front(forward<value_type>(x)); }
|
||||
queue_op_status nonblocking_push(BOOST_THREAD_RV_REF(value_type) x) { return queue.nonblocking_push_front(forward<value_type>(x)); }
|
||||
queue_op_status wait_push(BOOST_THREAD_RV_REF(value_type) x) { return queue.wait_push_front(forward<value_type>(x)); }
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -720,6 +720,7 @@ rule thread-compile ( sources : reqs * : name )
|
||||
[ thread-run2-noit ../example/ba_externallly_locked.cpp : ex_ba_externallly_locked ]
|
||||
[ thread-run2 ../example/producer_consumer_bounded.cpp : ex_producer_consumer_bounded ]
|
||||
[ thread-run2 ../example/producer_consumer.cpp : ex_producer_consumer ]
|
||||
[ thread-run2 ../example/producer_consumer2.cpp : ex_producer_consumer2 ]
|
||||
[ thread-run2 ../example/not_interleaved.cpp : ex_not_interleaved ]
|
||||
[ thread-run2 ../example/lambda_future.cpp : ex_lambda_future ]
|
||||
[ thread-run2 ../example/not_interleaved2.cpp : ex_not_interleaved2 ]
|
||||
@@ -850,7 +851,6 @@ rule thread-compile ( sources : reqs * : name )
|
||||
#[ thread-run test_9720.cpp ]
|
||||
#[ thread-run test_10125.cpp ]
|
||||
#[ thread-run test_10128.cpp ]
|
||||
[ thread-run2 ../example/producer_consumer2.cpp : ex_producer_consumer2 ]
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user