Revert of Protect MessageQueue stop field with a critical section to avoid data races. (patchset #5 id:80001 of https://codereview.webrtc.org/2023193002/ )
Reason for revert: Only reasonable CL in blameslist for broken Chrome FYI bots on all platforms. See https://build.chromium.org/p/chromium.webrtc.fyi/waterfall?builder=Mac%20Builder Original issue's description: > Protect MessageQueue stop field with a critical section to avoid data races. > > Committed: https://crrev.com/1d35d2971b1e89b3ecadb7fb1ff064f9af850ad4 > Cr-Commit-Position: refs/heads/master@{#13430} TBR=pthatcher@webrtc.org,tommi@webrtc.org,deadbeef@webrtc.org,tommi@chromium.org,pbos@webrtc.org,andresp@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review-Url: https://codereview.webrtc.org/2135173002 Cr-Commit-Position: refs/heads/master@{#13431}
This commit is contained in:
parent
1d35d2971b
commit
a2c900877d
@ -150,12 +150,8 @@ void MessageQueueManager::ProcessAllMessageQueuesInternal() {
|
||||
//------------------------------------------------------------------
|
||||
// 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::WakeUpSocketServer() {
|
||||
}
|
||||
|
||||
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 @@ bool MessageQueue::Get(Message *pmsg, int cmsWait, bool process_io) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (IsQuitting())
|
||||
if (fStop_)
|
||||
break;
|
||||
|
||||
// Which is shorter, the delay wait or the asked wait?
|
||||
@ -361,7 +357,7 @@ void MessageQueue::Post(const Location& posted_from,
|
||||
uint32_t id,
|
||||
MessageData* pdata,
|
||||
bool time_sensitive) {
|
||||
if (IsQuitting())
|
||||
if (fStop_)
|
||||
return;
|
||||
|
||||
// Keep thread safe
|
||||
@ -417,7 +413,7 @@ void MessageQueue::DoDelayPost(const Location& posted_from,
|
||||
MessageHandler* phandler,
|
||||
uint32_t id,
|
||||
MessageData* pdata) {
|
||||
if (IsQuitting()) {
|
||||
if (fStop_) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -288,6 +288,7 @@ class MessageQueue {
|
||||
|
||||
void WakeUpSocketServer();
|
||||
|
||||
bool fStop_;
|
||||
bool fPeekKeep_;
|
||||
Message msgPeek_;
|
||||
MessageList msgq_ GUARDED_BY(crit_);
|
||||
@ -298,8 +299,6 @@ class MessageQueue {
|
||||
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|.
|
||||
|
||||
@ -218,7 +218,7 @@ bool Thread::Start(Runnable* runnable) {
|
||||
ASSERT(!running());
|
||||
if (running()) return false;
|
||||
|
||||
Restart(); // reset IsQuitting() if the thread is being restarted
|
||||
Restart(); // reset fStop_ if the thread is being restarted
|
||||
|
||||
// Make sure that ThreadManager is created on the main thread before
|
||||
// we start a new thread.
|
||||
@ -346,7 +346,7 @@ void Thread::Send(const Location& posted_from,
|
||||
MessageHandler* phandler,
|
||||
uint32_t id,
|
||||
MessageData* pdata) {
|
||||
if (IsQuitting())
|
||||
if (fStop_)
|
||||
return;
|
||||
|
||||
// Sent messages are sent to the MessageHandler directly, in the context
|
||||
|
||||
@ -24,6 +24,7 @@ char kTSanDefaultSuppressions[] =
|
||||
// WebRTC specific suppressions.
|
||||
|
||||
// Split up suppressions covered previously by thread.cc and messagequeue.cc.
|
||||
"race:rtc::MessageQueue::Quit\n"
|
||||
"race:vp8cx_remove_encoder_threads\n"
|
||||
"race:third_party/libvpx/source/libvpx/vp9/common/vp9_scan.h\n"
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user