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

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: Created 4 years, 6 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 // Perform initialization, subclasses must call this from their constructor 273 // Perform initialization, subclasses must call this from their constructor
274 // if false was passed as init_queue to the MessageQueue constructor. 274 // if false was passed as init_queue to the MessageQueue constructor.
275 void DoInit(); 275 void DoInit();
276 276
277 // Perform cleanup, subclasses that override Clear must call this from the 277 // Perform cleanup, subclasses that override Clear must call this from the
278 // destructor. 278 // destructor.
279 void DoDestroy(); 279 void DoDestroy();
280 280
281 void WakeUpSocketServer(); 281 void WakeUpSocketServer();
282 282
283 bool fStop_;
284 bool fPeekKeep_; 283 bool fPeekKeep_;
285 Message msgPeek_; 284 Message msgPeek_;
286 MessageList msgq_ GUARDED_BY(crit_); 285 MessageList msgq_ GUARDED_BY(crit_);
287 PriorityQueue dmsgq_ GUARDED_BY(crit_); 286 PriorityQueue dmsgq_ GUARDED_BY(crit_);
288 uint32_t dmsgq_next_num_ GUARDED_BY(crit_); 287 uint32_t dmsgq_next_num_ GUARDED_BY(crit_);
289 CriticalSection crit_; 288 CriticalSection crit_;
290 bool fInitialized_; 289 bool fInitialized_;
291 bool fDestroyed_; 290 bool fDestroyed_;
292 291
293 private: 292 private:
293 bool stop_ GUARDED_BY(stop_crit_);
294 CriticalSection stop_crit_ ACQUIRED_AFTER(crit_);
295
294 // The SocketServer might not be owned by MessageQueue. 296 // The SocketServer might not be owned by MessageQueue.
295 SocketServer* ss_ GUARDED_BY(ss_lock_); 297 SocketServer* ss_ GUARDED_BY(ss_lock_);
296 // Used if SocketServer ownership lies with |this|. 298 // Used if SocketServer ownership lies with |this|.
297 std::unique_ptr<SocketServer> own_ss_; 299 std::unique_ptr<SocketServer> own_ss_;
298 SharedExclusiveLock ss_lock_; 300 SharedExclusiveLock ss_lock_;
299 301
300 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue); 302 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue);
301 }; 303 };
302 304
303 } // namespace rtc 305 } // namespace rtc
304 306
305 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_ 307 #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