| 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 | #ifndef RTC_BASE_SYNCHRONIZATION_MUTEX_ABSEIL_H_ |
| 12 | #define RTC_BASE_SYNCHRONIZATION_MUTEX_ABSEIL_H_ |
| 13 |
| 14 | #include "absl/synchronization/mutex.h" |
| 15 | #include "rtc_base/thread_annotations.h" |
| 16 |
| 17 | namespace webrtc { |
| 18 |
| 19 | class RTC_LOCKABLE MutexImpl final { |
| 20 | public: |
| 21 | MutexImpl() = default; |
| 22 | MutexImpl(const MutexImpl&) = delete; |
| 23 | MutexImpl& operator=(const MutexImpl&) = delete; |
| 24 |
| 25 | void Lock() RTC_EXCLUSIVE_LOCK_FUNCTION() { mutex_.Lock(); } |
| 26 | RTC_WARN_UNUSED_RESULT bool TryLock() RTC_EXCLUSIVE_TRYLOCK_FUNCTION(true) { |
| 27 | return mutex_.TryLock(); |
| 28 | } |
| 29 | void Unlock() RTC_UNLOCK_FUNCTION() { mutex_.Unlock(); } |
| 30 |
| 31 | private: |
| 32 | absl::Mutex mutex_; |
| 33 | }; |
| 34 |
| 35 | } // namespace webrtc |
| 36 |
| 37 | #endif // RTC_BASE_SYNCHRONIZATION_MUTEX_ABSEIL_H_ |
| 38 |