| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
#ifndef RTC_BASE_SYNCHRONIZATION_MUTEX_ABSEIL_H_ |
| 12 |
#define RTC_BASE_SYNCHRONIZATION_MUTEX_ABSEIL_H_ |
| 13 |
|
| 14 |
#include "absl/base/attributes.h" |
| 15 |
#include "absl/synchronization/mutex.h" |
| 16 |
#include "rtc_base/thread_annotations.h" |
| 17 |
|
| 18 |
namespace webrtc { |
| 19 |
|
| 20 |
class RTC_LOCKABLE MutexImpl final { |
| 21 |
public: |
| 22 |
MutexImpl() = default; |
| 23 |
MutexImpl(const MutexImpl&) = delete; |
| 24 |
MutexImpl& operator=(const MutexImpl&) = delete; |
| 25 |
|
| 26 |
void Lock() RTC_EXCLUSIVE_LOCK_FUNCTION() { mutex_.Lock(); } |
| 27 |
ABSL_MUST_USE_RESULT bool TryLock() RTC_EXCLUSIVE_TRYLOCK_FUNCTION(true) { |
| 28 |
return mutex_.TryLock(); |
| 29 |
} |
| 30 |
void Unlock() RTC_UNLOCK_FUNCTION() { mutex_.Unlock(); } |
| 31 |
|
| 32 |
private: |
| 33 |
absl::Mutex mutex_; |
| 34 |
}; |
| 35 |
|
| 36 |
} |
| 37 |
|
| 38 |
#endif |