1fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org/*
2fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org *
4fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org *  Use of this source code is governed by a BSD-style license
5fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org *  that can be found in the LICENSE file in the root of the source
6fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org *  tree. An additional intellectual property rights grant can be found
7fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org *  in the file PATENTS.  All contributing project authors may
8fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org *  be found in the AUTHORS file in the root of the source tree.
9fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org */
10fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org
11fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_POSIX_H_
12fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_POSIX_H_
13fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org
1498f53510b222f71fdd8b799b2f33737ceeb28c61Henrik Kjellander#include "webrtc/system_wrappers/include/rw_lock_wrapper.h"
15fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org#include "webrtc/typedefs.h"
16fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org
17fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org#include <pthread.h>
18fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org
19fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.orgnamespace webrtc {
20fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org
21fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.orgclass RWLockPosix : public RWLockWrapper {
22fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org public:
23fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org  static RWLockPosix* Create();
2414665ff7d4024d07e58622f498b23fd980001871kjellander@webrtc.org  ~RWLockPosix() override;
25fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org
2614665ff7d4024d07e58622f498b23fd980001871kjellander@webrtc.org  void AcquireLockExclusive() override;
2714665ff7d4024d07e58622f498b23fd980001871kjellander@webrtc.org  void ReleaseLockExclusive() override;
28fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org
2914665ff7d4024d07e58622f498b23fd980001871kjellander@webrtc.org  void AcquireLockShared() override;
3014665ff7d4024d07e58622f498b23fd980001871kjellander@webrtc.org  void ReleaseLockShared() override;
31fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org
32fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org private:
33fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org  RWLockPosix();
34fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org  bool Init();
35fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org
36fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org  pthread_rwlock_t lock_;
37fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org};
38fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org
39fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org}  // namespace webrtc
40fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org
41fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org#endif  // WEBRTC_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_POSIX_H_
42