Added retain where applicable

This commit is contained in:
Peter Conrad 2019-04-27 16:29:55 +02:00
parent 7cf371736b
commit 19bbc4080e
3 changed files with 4 additions and 0 deletions

View file

@ -72,6 +72,7 @@ namespace fc {
void set_exception( const fc::exception_ptr& e );
// HERE BE DRAGONS
void retain();
void release();

View file

@ -99,6 +99,7 @@ namespace fc {
typedef typename fc::deduce<Functor>::type FunctorType;
typename task<Result,sizeof(FunctorType)>::ptr tsk =
task<Result,sizeof(FunctorType)>::create( fc::forward<Functor>(f), desc );
tsk->retain(); // HERE BE DRAFONS
fc::future<Result> r( std::dynamic_pointer_cast< promise<Result> >(tsk) );
detail::get_worker_pool().post( tsk.get() );
return r;

View file

@ -89,6 +89,7 @@ namespace fc {
typedef typename fc::deduce<Functor>::type FunctorType;
typename task<Result,sizeof(FunctorType)>::ptr tsk =
task<Result,sizeof(FunctorType)>::create( fc::forward<Functor>(f), desc );
tsk->retain(); // HERE BE DRAFONS
fc::future<Result> r( std::dynamic_pointer_cast< promise<Result> >(tsk) );
async_task(tsk.get(),prio);
return r;
@ -111,6 +112,7 @@ namespace fc {
typedef decltype(f()) Result;
typename task<Result,sizeof(Functor)>::ptr tsk =
task<Result,sizeof(Functor)>::create( fc::forward<Functor>(f), desc );
tsk->retain(); // HERE BE DRAFONS
fc::future<Result> r( std::dynamic_pointer_cast< promise<Result> >(tsk) );
async_task(tsk.get(),prio,when);
return r;