From 19bbc4080eb37b396a19286ffdb4fc889f301ef8 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Sat, 27 Apr 2019 16:29:55 +0200 Subject: [PATCH] Added retain where applicable --- include/fc/thread/future.hpp | 1 + include/fc/thread/parallel.hpp | 1 + include/fc/thread/thread.hpp | 2 ++ 3 files changed, 4 insertions(+) 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;