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

Unified Diff: webrtc/base/messagequeue.cc

Issue 2135173002: Revert of Protect MessageQueue stop field with a critical section to avoid data races. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 5 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 | « webrtc/base/messagequeue.h ('k') | webrtc/base/thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/messagequeue.cc
diff --git a/webrtc/base/messagequeue.cc b/webrtc/base/messagequeue.cc
index ebf98f58a34e3539a85bb4068bddadf8eab9c678..591a6b834f92e4ff221fc85c96829a54fc23c9e6 100644
--- a/webrtc/base/messagequeue.cc
+++ b/webrtc/base/messagequeue.cc
@@ -150,12 +150,8 @@
//------------------------------------------------------------------
// MessageQueue
MessageQueue::MessageQueue(SocketServer* ss, bool init_queue)
- : fPeekKeep_(false),
- dmsgq_next_num_(0),
- fInitialized_(false),
- fDestroyed_(false),
- stop_(0),
- ss_(ss) {
+ : fStop_(false), fPeekKeep_(false),
+ dmsgq_next_num_(0), fInitialized_(false), fDestroyed_(false), ss_(ss) {
RTC_DCHECK(ss);
// Currently, MessageQueue holds a socket server, and is the base class for
// Thread. It seems like it makes more sense for Thread to hold the socket
@@ -227,16 +223,16 @@
}
void MessageQueue::Quit() {
- AtomicOps::ReleaseStore(&stop_, 1);
+ fStop_ = true;
WakeUpSocketServer();
}
bool MessageQueue::IsQuitting() {
- return AtomicOps::AcquireLoad(&stop_) != 0;
+ return fStop_;
}
void MessageQueue::Restart() {
- AtomicOps::ReleaseStore(&stop_, 0);
+ fStop_ = false;
}
bool MessageQueue::Peek(Message *pmsg, int cmsWait) {
@@ -320,7 +316,7 @@
return true;
}
- if (IsQuitting())
+ if (fStop_)
break;
// Which is shorter, the delay wait or the asked wait?
@@ -361,7 +357,7 @@
uint32_t id,
MessageData* pdata,
bool time_sensitive) {
- if (IsQuitting())
+ if (fStop_)
return;
// Keep thread safe
@@ -417,7 +413,7 @@
MessageHandler* phandler,
uint32_t id,
MessageData* pdata) {
- if (IsQuitting()) {
+ if (fStop_) {
return;
}
« no previous file with comments | « webrtc/base/messagequeue.h ('k') | webrtc/base/thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698