Fix for problem reported with Boost 1.55 (memory_order_consume removed?). Also added move constructors for future, this second change probably needs review.

This commit is contained in:
dnotestein 2013-12-12 09:19:15 -05:00
parent e6dcfa40f9
commit 8e47816c4e
2 changed files with 16 additions and 2 deletions

View file

@ -171,6 +171,12 @@ namespace fc {
future( fc::shared_ptr<promise<T>>&& p ):m_prom(fc::move(p)){}
future(){}
future& operator=(future<T>&& f ) {
fc_swap(m_prom,f.m_prom);
return *this;
}
operator const T&()const { return wait(); }
/// @pre valid()
@ -220,6 +226,12 @@ namespace fc {
future( const fc::shared_ptr<promise<void>>& p ):m_prom(p){}
future( fc::shared_ptr<promise<void>>&& p ):m_prom(fc::move(p)){}
future(){}
future& operator=(future<void>&& f ) {
fc_swap(m_prom,f.m_prom);
return *this;
}
/// @pre valid()
/// @post ready()

View file

@ -217,8 +217,10 @@ namespace fc {
BOOST_ASSERT( this == thread::current().my );
task_base* pending = 0;
pending = task_in_queue.exchange(0,boost::memory_order_consume);
//DLN: changed from memory_order_consume for boost 1.55.
//This appears to be safest replacement for now, maybe
//can be changed to relaxed later, but needs analysis.
pending = task_in_queue.exchange(0,boost::memory_order_seq_cst);
if( pending ) { enqueue( pending ); }
task_base* p(0);