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() {
|
void task_base::run_impl() {
|
||||||
try {
|
try {
|
||||||
|
if( !canceled() )
|
||||||
_run_functor( _functor, _promise_impl );
|
_run_functor( _functor, _promise_impl );
|
||||||
|
else
|
||||||
|
FC_THROW_EXCEPTION( canceled_exception, "${description}", ("description", get_desc() ) );
|
||||||
}
|
}
|
||||||
catch ( const exception& e )
|
catch ( const exception& e )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -341,6 +341,7 @@ namespace fc {
|
||||||
bool run_next_task() {
|
bool run_next_task() {
|
||||||
check_for_timeouts();
|
check_for_timeouts();
|
||||||
task_base* next = dequeue();
|
task_base* next = dequeue();
|
||||||
|
|
||||||
if( next ) {
|
if( next ) {
|
||||||
next->_set_active_context( current );
|
next->_set_active_context( current );
|
||||||
current->cur_task = next;
|
current->cur_task = next;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue