add cancel sync, filter out wait for canceled tasks
This commit is contained in:
parent
6171e973c7
commit
30296957f7
2 changed files with 7 additions and 1 deletions
|
|
@ -27,6 +27,7 @@ namespace fc {
|
||||||
}
|
}
|
||||||
|
|
||||||
void promise_base::cancel(const char* reason /* = nullptr */){
|
void promise_base::cancel(const char* reason /* = nullptr */){
|
||||||
|
synchronized(_spin_yield)
|
||||||
// wlog("${desc} canceled!", ("desc", _desc? _desc : ""));
|
// wlog("${desc} canceled!", ("desc", _desc? _desc : ""));
|
||||||
_canceled = true;
|
_canceled = true;
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
|
|
||||||
|
|
@ -596,7 +596,12 @@ namespace fc {
|
||||||
else if( timeout_time != time_point::min() )
|
else if( timeout_time != time_point::min() )
|
||||||
{
|
{
|
||||||
// there may be tasks that have been canceled we should filter them out now
|
// 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
|
/* This bit is kind of sloppy -- this wait was originally implemented as a wait
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue