rw_lock_posix.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
  3. *
  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
  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. #ifndef RTC_BASE_SYNCHRONIZATION_RW_LOCK_POSIX_H_
  11. #define RTC_BASE_SYNCHRONIZATION_RW_LOCK_POSIX_H_
  12. #include <pthread.h>
  13. #include "rtc_base/synchronization/rw_lock_wrapper.h"
  14. namespace webrtc {
  15. class RWLockPosix : public RWLockWrapper {
  16. public:
  17. static RWLockPosix* Create();
  18. ~RWLockPosix() override;
  19. void AcquireLockExclusive() override;
  20. void ReleaseLockExclusive() override;
  21. void AcquireLockShared() override;
  22. void ReleaseLockShared() override;
  23. private:
  24. RWLockPosix();
  25. bool Init();
  26. pthread_rwlock_t lock_;
  27. };
  28. } // namespace webrtc
  29. #endif // RTC_BASE_SYNCHRONIZATION_RW_LOCK_POSIX_H_