diff --git a/src/thread/future.cpp b/src/thread/future.cpp index 2111584..95485b9 100755 --- a/src/thread/future.cpp +++ b/src/thread/future.cpp @@ -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 diff --git a/src/thread/thread_d.hpp b/src/thread/thread_d.hpp index 8e36b14..2a6c995 100755 --- a/src/thread/thread_d.hpp +++ b/src/thread/thread_d.hpp @@ -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