diff --git a/include/fc/thread/future.hpp b/include/fc/thread/future.hpp index a6937c6..0adc69a 100644 --- a/include/fc/thread/future.hpp +++ b/include/fc/thread/future.hpp @@ -72,6 +72,7 @@ namespace fc { void set_exception( const fc::exception_ptr& e ); + // HERE BE DRAGONS void retain(); void release(); diff --git a/include/fc/thread/parallel.hpp b/include/fc/thread/parallel.hpp index f66e1c6..433dfbf 100644 --- a/include/fc/thread/parallel.hpp +++ b/include/fc/thread/parallel.hpp @@ -99,6 +99,7 @@ namespace fc { typedef typename fc::deduce::type FunctorType; typename task::ptr tsk = task::create( fc::forward(f), desc ); + tsk->retain(); // HERE BE DRAFONS fc::future r( std::dynamic_pointer_cast< promise >(tsk) ); detail::get_worker_pool().post( tsk.get() ); return r; diff --git a/include/fc/thread/thread.hpp b/include/fc/thread/thread.hpp index 5c08b71..a01dc20 100644 --- a/include/fc/thread/thread.hpp +++ b/include/fc/thread/thread.hpp @@ -89,6 +89,7 @@ namespace fc { typedef typename fc::deduce::type FunctorType; typename task::ptr tsk = task::create( fc::forward(f), desc ); + tsk->retain(); // HERE BE DRAFONS fc::future r( std::dynamic_pointer_cast< promise >(tsk) ); async_task(tsk.get(),prio); return r; @@ -111,6 +112,7 @@ namespace fc { typedef decltype(f()) Result; typename task::ptr tsk = task::create( fc::forward(f), desc ); + tsk->retain(); // HERE BE DRAFONS fc::future r( std::dynamic_pointer_cast< promise >(tsk) ); async_task(tsk.get(),prio,when); return r;