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

Side by Side Diff: webrtc/base/sharedexclusivelock.cc

Issue 2865083002: Delete unused class SharedExclusiveLock. (Closed)
Patch Set: Created 3 years, 7 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 | « webrtc/base/sharedexclusivelock.h ('k') | webrtc/base/sharedexclusivelock_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2011 The WebRTC Project Authors. All rights reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/base/sharedexclusivelock.h"
12
13 namespace rtc {
14
15 SharedExclusiveLock::SharedExclusiveLock()
16 : shared_count_is_zero_(true, true),
17 shared_count_(0) {
18 }
19
20 void SharedExclusiveLock::LockExclusive() {
21 cs_exclusive_.Enter();
22 shared_count_is_zero_.Wait(Event::kForever);
23 }
24
25 void SharedExclusiveLock::UnlockExclusive() {
26 cs_exclusive_.Leave();
27 }
28
29 void SharedExclusiveLock::LockShared() {
30 CritScope exclusive_scope(&cs_exclusive_);
31 CritScope shared_scope(&cs_shared_);
32 if (++shared_count_ == 1) {
33 shared_count_is_zero_.Reset();
34 }
35 }
36
37 void SharedExclusiveLock::UnlockShared() {
38 CritScope shared_scope(&cs_shared_);
39 if (--shared_count_ == 0) {
40 shared_count_is_zero_.Set();
41 }
42 }
43
44 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/sharedexclusivelock.h ('k') | webrtc/base/sharedexclusivelock_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698