OLD | NEW |
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // IMPORTANT: Unlike CritScope, the lock may not be owned by this thread in | 82 // IMPORTANT: Unlike CritScope, the lock may not be owned by this thread in |
83 // subsequent code. Users *must* check locked() to determine if the | 83 // subsequent code. Users *must* check locked() to determine if the |
84 // lock was taken. If you're not calling locked(), you're doing it wrong! | 84 // lock was taken. If you're not calling locked(), you're doing it wrong! |
85 class TryCritScope { | 85 class TryCritScope { |
86 public: | 86 public: |
87 explicit TryCritScope(CriticalSection* cs); | 87 explicit TryCritScope(CriticalSection* cs); |
88 ~TryCritScope(); | 88 ~TryCritScope(); |
89 #if defined(WEBRTC_WIN) | 89 #if defined(WEBRTC_WIN) |
90 _Check_return_ bool locked() const; | 90 _Check_return_ bool locked() const; |
91 #else | 91 #else |
92 bool locked() const __attribute__((warn_unused_result)); | 92 bool locked() const __attribute__ ((__warn_unused_result__)); |
93 #endif | 93 #endif |
94 private: | 94 private: |
95 CriticalSection* const cs_; | 95 CriticalSection* const cs_; |
96 const bool locked_; | 96 const bool locked_; |
97 CS_DEBUG_CODE(mutable bool lock_was_called_); | 97 CS_DEBUG_CODE(mutable bool lock_was_called_); |
98 RTC_DISALLOW_COPY_AND_ASSIGN(TryCritScope); | 98 RTC_DISALLOW_COPY_AND_ASSIGN(TryCritScope); |
99 }; | 99 }; |
100 | 100 |
101 // A POD lock used to protect global variables. Do NOT use for other purposes. | 101 // A POD lock used to protect global variables. Do NOT use for other purposes. |
102 // No custom constructor or private data member should be added. | 102 // No custom constructor or private data member should be added. |
(...skipping 17 matching lines...) Expand all Loading... |
120 explicit GlobalLockScope(GlobalLockPod* lock) EXCLUSIVE_LOCK_FUNCTION(lock); | 120 explicit GlobalLockScope(GlobalLockPod* lock) EXCLUSIVE_LOCK_FUNCTION(lock); |
121 ~GlobalLockScope() UNLOCK_FUNCTION(); | 121 ~GlobalLockScope() UNLOCK_FUNCTION(); |
122 private: | 122 private: |
123 GlobalLockPod* const lock_; | 123 GlobalLockPod* const lock_; |
124 RTC_DISALLOW_COPY_AND_ASSIGN(GlobalLockScope); | 124 RTC_DISALLOW_COPY_AND_ASSIGN(GlobalLockScope); |
125 }; | 125 }; |
126 | 126 |
127 } // namespace rtc | 127 } // namespace rtc |
128 | 128 |
129 #endif // WEBRTC_BASE_CRITICALSECTION_H_ | 129 #endif // WEBRTC_BASE_CRITICALSECTION_H_ |
OLD | NEW |