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

Side by Side Diff: webrtc/base/messagequeue.h

Issue 2023193002: 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: Clear suppresion is needed for vtable/destructor race 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/base/messagequeue.cc » ('j') | webrtc/base/messagequeue.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // Perform initialization, subclasses must call this from their constructor 278 // Perform initialization, subclasses must call this from their constructor
279 // if false was passed as init_queue to the MessageQueue constructor. 279 // if false was passed as init_queue to the MessageQueue constructor.
280 void DoInit(); 280 void DoInit();
281 281
282 // Perform cleanup, subclasses that override Clear must call this from the 282 // Perform cleanup, subclasses that override Clear must call this from the
283 // destructor. 283 // destructor.
284 void DoDestroy(); 284 void DoDestroy();
285 285
286 void WakeUpSocketServer(); 286 void WakeUpSocketServer();
287 287
288 bool fStop_;
289 bool fPeekKeep_; 288 bool fPeekKeep_;
290 Message msgPeek_; 289 Message msgPeek_;
291 MessageList msgq_ GUARDED_BY(crit_); 290 MessageList msgq_ GUARDED_BY(crit_);
292 PriorityQueue dmsgq_ GUARDED_BY(crit_); 291 PriorityQueue dmsgq_ GUARDED_BY(crit_);
293 uint32_t dmsgq_next_num_ GUARDED_BY(crit_); 292 uint32_t dmsgq_next_num_ GUARDED_BY(crit_);
294 CriticalSection crit_; 293 CriticalSection crit_;
295 bool fInitialized_; 294 bool fInitialized_;
296 bool fDestroyed_; 295 bool fDestroyed_;
297 296
298 private: 297 private:
298 volatile int stop_;
299
299 // The SocketServer might not be owned by MessageQueue. 300 // The SocketServer might not be owned by MessageQueue.
300 SocketServer* ss_ GUARDED_BY(ss_lock_); 301 SocketServer* ss_ GUARDED_BY(ss_lock_);
301 // Used if SocketServer ownership lies with |this|. 302 // Used if SocketServer ownership lies with |this|.
302 std::unique_ptr<SocketServer> own_ss_; 303 std::unique_ptr<SocketServer> own_ss_;
303 SharedExclusiveLock ss_lock_; 304 SharedExclusiveLock ss_lock_;
304 305
305 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue); 306 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue);
306 }; 307 };
307 308
308 } // namespace rtc 309 } // namespace rtc
309 310
310 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_ 311 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/messagequeue.cc » ('j') | webrtc/base/messagequeue.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698