未验证 提交 704e454f 编写于 作者: L liutiexing 提交者: GitHub

Fix cancel (#36740)

* add align for WorkQueue

* add spinlock

* merge develop

* merge

* Add EventsWaiter

* update

* update

* update Error MSG

* update EventsWaiter

* Add Cancel For ThreadPool

* Add UT for Cancel

* fix Cancel
上级 7de3f81c
......@@ -394,16 +394,16 @@ class ThreadPoolTempl {
// We already did best-effort emptiness check in Steal, so prepare for
// blocking.
ec_.Prewait();
if (cancelled_) {
ec_.CancelWait();
return false;
}
// Now do a reliable emptiness check.
int victim = NonEmptyQueueIndex();
if (victim != -1) {
ec_.CancelWait();
if (cancelled_) {
return false;
} else {
*t = thread_data_[victim].queue.PopBack();
return true;
}
*t = thread_data_[victim].queue.PopBack();
return true;
}
// Number of blocked threads is used as termination condition.
// If we are shutting down and all worker threads blocked without work,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册