Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Unified Diff: base/threading/sequenced_worker_pool.cc

Issue 1013463003: Update from https://crrev.com/320931 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/third_party/nspr/BUILD.gn ('k') | base/threading/sequenced_worker_pool_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/sequenced_worker_pool.cc
diff --git a/base/threading/sequenced_worker_pool.cc b/base/threading/sequenced_worker_pool.cc
index f20d9972261c3b26269564ba3b198ce1aba1be49..52b178bcd5f42be4a71d45b692d5e879b033bf04 100644
--- a/base/threading/sequenced_worker_pool.cc
+++ b/base/threading/sequenced_worker_pool.cc
@@ -803,6 +803,20 @@ void SequencedWorkerPool::Inner::ThreadLoop(Worker* this_worker) {
delete_these_outside_lock.clear();
break;
}
+
+ // No work was found, but there are tasks that need deletion. The
+ // deletion must happen outside of the lock.
+ if (delete_these_outside_lock.size()) {
+ AutoUnlock unlock(lock_);
+ delete_these_outside_lock.clear();
+
+ // Since the lock has been released, |status| may no longer be
+ // accurate. It might read GET_WORK_WAIT even if there are tasks
+ // ready to perform work. Jump to the top of the loop to recalculate
+ // |status|.
+ continue;
+ }
+
waiting_thread_count_++;
switch (status) {
« no previous file with comments | « base/third_party/nspr/BUILD.gn ('k') | base/threading/sequenced_worker_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698