Protect MessageQueue stop field with a critical section to avoid data races.
Review-Url: https://codereview.webrtc.org/2023193002
Cr-Commit-Position: refs/heads/master@{#13430}
diff --git a/webrtc/base/messagequeue.h b/webrtc/base/messagequeue.h
index a1b20da..628ce44 100644
--- a/webrtc/base/messagequeue.h
+++ b/webrtc/base/messagequeue.h
@@ -288,7 +288,6 @@
void WakeUpSocketServer();
- bool fStop_;
bool fPeekKeep_;
Message msgPeek_;
MessageList msgq_ GUARDED_BY(crit_);
@@ -299,6 +298,8 @@
bool fDestroyed_;
private:
+ volatile int stop_;
+
// The SocketServer might not be owned by MessageQueue.
SocketServer* ss_ GUARDED_BY(ss_lock_);
// Used if SocketServer ownership lies with |this|.