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

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: initialize with 0 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') | no next file with comments »
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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 // Perform initialization, subclasses must call this from their constructor 281 // Perform initialization, subclasses must call this from their constructor
282 // if false was passed as init_queue to the MessageQueue constructor. 282 // if false was passed as init_queue to the MessageQueue constructor.
283 void DoInit(); 283 void DoInit();
284 284
285 // Perform cleanup, subclasses that override Clear must call this from the 285 // Perform cleanup, subclasses that override Clear must call this from the
286 // destructor. 286 // destructor.
287 void DoDestroy(); 287 void DoDestroy();
288 288
289 void WakeUpSocketServer(); 289 void WakeUpSocketServer();
290 290
291 bool fStop_;
292 bool fPeekKeep_; 291 bool fPeekKeep_;
293 Message msgPeek_; 292 Message msgPeek_;
294 MessageList msgq_ GUARDED_BY(crit_); 293 MessageList msgq_ GUARDED_BY(crit_);
295 PriorityQueue dmsgq_ GUARDED_BY(crit_); 294 PriorityQueue dmsgq_ GUARDED_BY(crit_);
296 uint32_t dmsgq_next_num_ GUARDED_BY(crit_); 295 uint32_t dmsgq_next_num_ GUARDED_BY(crit_);
297 CriticalSection crit_; 296 CriticalSection crit_;
298 bool fInitialized_; 297 bool fInitialized_;
299 bool fDestroyed_; 298 bool fDestroyed_;
300 299
301 private: 300 private:
301 volatile int stop_;
302
302 // The SocketServer might not be owned by MessageQueue. 303 // The SocketServer might not be owned by MessageQueue.
303 SocketServer* ss_ GUARDED_BY(ss_lock_); 304 SocketServer* ss_ GUARDED_BY(ss_lock_);
304 // Used if SocketServer ownership lies with |this|. 305 // Used if SocketServer ownership lies with |this|.
305 std::unique_ptr<SocketServer> own_ss_; 306 std::unique_ptr<SocketServer> own_ss_;
306 SharedExclusiveLock ss_lock_; 307 SharedExclusiveLock ss_lock_;
307 308
308 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue); 309 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue);
309 }; 310 };
310 311
311 } // namespace rtc 312 } // namespace rtc
312 313
313 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_ 314 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/messagequeue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698