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

Unified Diff: base/message_loop/incoming_task_queue.h

Issue 1991623002: Avoid holding |incoming_queue_lock_| while waking up the message loop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@base-rw-lock
Patch Set: Rebase Created 4 years, 7 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 | « no previous file | base/message_loop/incoming_task_queue.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/incoming_task_queue.h
diff --git a/base/message_loop/incoming_task_queue.h b/base/message_loop/incoming_task_queue.h
index 608eca0bbda1cb31ff13fdfcd6000d19c94188b3..aff71d20bf8b3a13b8270123ec3b0ca11cc6089d 100644
--- a/base/message_loop/incoming_task_queue.h
+++ b/base/message_loop/incoming_task_queue.h
@@ -10,6 +10,7 @@
#include "base/memory/ref_counted.h"
#include "base/pending_task.h"
#include "base/synchronization/lock.h"
+#include "base/synchronization/read_write_lock.h"
#include "base/time/time.h"
namespace base {
@@ -75,9 +76,14 @@ class BASE_EXPORT IncomingTaskQueue
// so that ReloadWorkQueue() completes in constant time.
int high_res_task_count_;
- // The lock that protects access to the members of this class.
+ // The lock that protects access to the members of this class, except
+ // |message_loop_|.
base::Lock incoming_queue_lock_;
+ // Lock that protects |message_loop_| to prevent it from being deleted while a
+ // task is being posted.
+ base::subtle::ReadWriteLock message_loop_lock_;
+
// An incoming queue of tasks that are acquired under a mutex for processing
// on this instance's thread. These tasks have not yet been been pushed to
// |message_loop_|.
« no previous file with comments | « no previous file | base/message_loop/incoming_task_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698