if a task is canceled before it is run, then it will throw a canceled exception

This commit is contained in:
Daniel Larimer 2014-06-28 21:08:15 -04:00
parent 1e80a7071f
commit ffa617183e
2 changed files with 5 additions and 1 deletions

View file

@ -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 )
{

View file

@ -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;