add cancel sync, filter out wait for canceled tasks

This commit is contained in:
Pavel Baykov 2022-03-29 10:48:13 -03:00
parent 6171e973c7
commit 30296957f7
2 changed files with 7 additions and 1 deletions

View file

@ -27,6 +27,7 @@ namespace fc {
}
void promise_base::cancel(const char* reason /* = nullptr */){
synchronized(_spin_yield)
// wlog("${desc} canceled!", ("desc", _desc? _desc : ""));
_canceled = true;
#ifndef NDEBUG

View file

@ -596,7 +596,12 @@ namespace fc {
else if( timeout_time != time_point::min() )
{
// there may be tasks that have been canceled we should filter them out now
// rather than waiting...
// rather than waiting...
//
if (current->canceled){
return;
}
/* This bit is kind of sloppy -- this wait was originally implemented as a wait