1470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com/*
2785db5a2a5d3209e98310f2ade62a7afbd27d15aleozwang@webrtc.org *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com *
4470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com *  Use of this source code is governed by a BSD-style license
5470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com *  that can be found in the LICENSE file in the root of the source
6470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com *  tree. An additional intellectual property rights grant can be found
7470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com *  in the file PATENTS.  All contributing project authors may
8470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com *  be found in the AUTHORS file in the root of the source tree.
9470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com */
10470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com
1198f53510b222f71fdd8b799b2f33737ceeb28c61Henrik Kjellander#include "webrtc/system_wrappers/include/rw_lock_wrapper.h"
12470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com
13fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org#include <assert.h>
14470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com
15fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org#if defined(_WIN32)
16fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org#include "webrtc/system_wrappers/source/rw_lock_generic.h"
17fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org#include "webrtc/system_wrappers/source/rw_lock_win.h"
18fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org#else
19fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org#include "webrtc/system_wrappers/source/rw_lock_posix.h"
20fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org#endif
219f84723725a364486f9d6a9810ffd956db6daafbhenrike@webrtc.org
22fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.orgnamespace webrtc {
2375025434bf44860b3ca6228e9ac525fa44609f76pbos@webrtc.org
2475025434bf44860b3ca6228e9ac525fa44609f76pbos@webrtc.orgRWLockWrapper* RWLockWrapper::CreateRWLock() {
25fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org#ifdef _WIN32
26fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org  // Native implementation is faster, so use that if available.
27fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org  RWLockWrapper* lock = RWLockWin::Create();
28fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org  if (lock) {
29fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org    return lock;
30fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org  }
31fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org  return new RWLockGeneric();
32fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org#else
33fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org  return RWLockPosix::Create();
34fe19699a207e5ac8a655c69e2e8a83da2f4dd78etommi@webrtc.org#endif
35470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com}
36470e71d3649f6cac4688e83819640b012b5d38bbniklase@google.com
379f84723725a364486f9d6a9810ffd956db6daafbhenrike@webrtc.org}  // namespace webrtc
38