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

Unified Diff: webrtc/base/thread.cc

Issue 1666863002: Fix race between Thread ctor/dtor and MessageQueueManager registrations. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 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
« webrtc/base/messagequeue.cc ('K') | « webrtc/base/messagequeue.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/thread.cc
diff --git a/webrtc/base/thread.cc b/webrtc/base/thread.cc
index 4197d28175a05037f5ad953aba64d6b72ae62bef..9de99cdc710e552c51c153311807951c49d46025 100644
--- a/webrtc/base/thread.cc
+++ b/webrtc/base/thread.cc
@@ -139,7 +139,7 @@ Thread::ScopedDisallowBlockingCalls::~ScopedDisallowBlockingCalls() {
}
Thread::Thread(SocketServer* ss)
- : MessageQueue(ss),
+ : MessageQueue(ss, false),
running_(true, false),
#if defined(WEBRTC_WIN)
thread_(NULL),
@@ -148,11 +148,12 @@ Thread::Thread(SocketServer* ss)
owned_(true),
blocking_calls_allowed_(true) {
SetName("Thread", this); // default name
+ MessageQueueManager::Add(this);
pthatcher1 2016/02/03 23:51:47 So, is this basically to make sure that SocketServ
joachim 2016/02/04 00:01:20 Please see my comment in messagequeue.cc. The chan
}
Thread::~Thread() {
Stop();
- Clear(NULL);
pthatcher1 2016/02/03 23:51:47 Why do we want to not call Clear(NULL) here? Is i
joachim 2016/02/04 00:01:20 We want to have the object removed from the Messag
pthatcher1 2016/02/04 00:50:38 That makes it clear why we should call DoDestroy()
joachim 2016/02/04 01:00:09 DoDestroy calls Clear(NULL) internally so I think
+ DoDestroy();
pthatcher1 2016/02/03 23:51:47 Can you leave a comment like "We can't rely on the
joachim 2016/02/04 00:01:20 I added a similar comment at the destructor of Mes
pthatcher1 2016/02/04 00:50:38 FYI, I don't see the new comments.
joachim 2016/02/04 01:00:09 Sorry for not being clearer, it's in messagequeue.
pthatcher1 2016/02/04 03:14:11 Right, but can you put one in the ctor also explai
joachim 2016/02/04 08:35:56 Done.
}
bool Thread::SleepMs(int milliseconds) {
« webrtc/base/messagequeue.cc ('K') | « webrtc/base/messagequeue.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698