12345678910111213141516171819202122232425262728293031323334353637 |
- #ifndef RTC_BASE_SYNCHRONIZATION_MUTEX_ABSEIL_H_
- #define RTC_BASE_SYNCHRONIZATION_MUTEX_ABSEIL_H_
- #include "absl/synchronization/mutex.h"
- #include "rtc_base/thread_annotations.h"
- namespace webrtc {
- class RTC_LOCKABLE MutexImpl final {
- public:
- MutexImpl() = default;
- MutexImpl(const MutexImpl&) = delete;
- MutexImpl& operator=(const MutexImpl&) = delete;
- void Lock() RTC_EXCLUSIVE_LOCK_FUNCTION() { mutex_.Lock(); }
- RTC_WARN_UNUSED_RESULT bool TryLock() RTC_EXCLUSIVE_TRYLOCK_FUNCTION(true) {
- return mutex_.TryLock();
- }
- void Unlock() RTC_UNLOCK_FUNCTION() { mutex_.Unlock(); }
- private:
- absl::Mutex mutex_;
- };
- }
- #endif
|