diff --git a/include/fc/thread/future.hpp b/include/fc/thread/future.hpp index 85bdbd4..cf57a24 100644 --- a/include/fc/thread/future.hpp +++ b/include/fc/thread/future.hpp @@ -169,8 +169,15 @@ namespace fc { public: future( const fc::shared_ptr>& p ):m_prom(p){} future( fc::shared_ptr>&& p ):m_prom(fc::move(p)){} + future(const future& f ) : m_prom(f.m_prom){} future(){} + future& operator=(future&& f ) { + fc_swap(m_prom,f.m_prom); + return *this; + } + + operator const T&()const { return wait(); } /// @pre valid() @@ -219,7 +226,14 @@ namespace fc { public: future( const fc::shared_ptr>& p ):m_prom(p){} future( fc::shared_ptr>&& p ):m_prom(fc::move(p)){} + future(const future& f ) : m_prom(f.m_prom){} future(){} + + future& operator=(future&& f ) { + fc_swap(m_prom,f.m_prom); + return *this; + } + /// @pre valid() /// @post ready() diff --git a/src/thread/thread_d.hpp b/src/thread/thread_d.hpp index 8f5237f..bac4aa0 100644 --- a/src/thread/thread_d.hpp +++ b/src/thread/thread_d.hpp @@ -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);