if a task is canceled before it is run, then it will throw a canceled exception
This commit is contained in:
parent
1e80a7071f
commit
ffa617183e
2 changed files with 5 additions and 1 deletions
|
|
@ -35,7 +35,10 @@ namespace fc {
|
|||
}
|
||||
void task_base::run_impl() {
|
||||
try {
|
||||
_run_functor( _functor, _promise_impl );
|
||||
if( !canceled() )
|
||||
_run_functor( _functor, _promise_impl );
|
||||
else
|
||||
FC_THROW_EXCEPTION( canceled_exception, "${description}", ("description", get_desc() ) );
|
||||
}
|
||||
catch ( const exception& e )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -341,6 +341,7 @@ namespace fc {
|
|||
bool run_next_task() {
|
||||
check_for_timeouts();
|
||||
task_base* next = dequeue();
|
||||
|
||||
if( next ) {
|
||||
next->_set_active_context( current );
|
||||
current->cur_task = next;
|
||||
|
|
|
|||
Loading…
Reference in a new issue