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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 class LOCKABLE CriticalSection { | 44 class LOCKABLE CriticalSection { |
45 public: | 45 public: |
46 CriticalSection(); | 46 CriticalSection(); |
47 ~CriticalSection(); | 47 ~CriticalSection(); |
48 | 48 |
49 void Enter() EXCLUSIVE_LOCK_FUNCTION(); | 49 void Enter() EXCLUSIVE_LOCK_FUNCTION(); |
50 bool TryEnter() EXCLUSIVE_TRYLOCK_FUNCTION(true); | 50 bool TryEnter() EXCLUSIVE_TRYLOCK_FUNCTION(true); |
51 void Leave() UNLOCK_FUNCTION(); | 51 void Leave() UNLOCK_FUNCTION(); |
52 | 52 |
53 // Use only for DCHECKing. | 53 // Use only for RTC_DCHECKing. |
54 bool CurrentThreadIsOwner() const; | 54 bool CurrentThreadIsOwner() const; |
55 // Use only for DCHECKing. | 55 // Use only for RTC_DCHECKing. |
56 bool IsLocked() const; | 56 bool IsLocked() const; |
57 | 57 |
58 private: | 58 private: |
59 #if defined(WEBRTC_WIN) | 59 #if defined(WEBRTC_WIN) |
60 CRITICAL_SECTION crit_; | 60 CRITICAL_SECTION crit_; |
61 #elif defined(WEBRTC_POSIX) | 61 #elif defined(WEBRTC_POSIX) |
62 pthread_mutex_t mutex_; | 62 pthread_mutex_t mutex_; |
63 CS_DEBUG_CODE(pthread_t thread_); | 63 CS_DEBUG_CODE(pthread_t thread_); |
64 CS_DEBUG_CODE(int recursion_count_); | 64 CS_DEBUG_CODE(int recursion_count_); |
65 #endif | 65 #endif |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |