niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
leozwang@webrtc.org | 785db5a | 2012-02-28 23:10:03 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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 | |
Henrik Kjellander | 98f5351 | 2015-10-28 18:17:40 +0100 | [diff] [blame] | 11 | #include "webrtc/system_wrappers/include/rw_lock_wrapper.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 12 | |
tommi@webrtc.org | fe19699 | 2015-02-07 22:35:54 +0000 | [diff] [blame] | 13 | #include <assert.h> |
| 14 | |
| 15 | #if defined(_WIN32) |
tommi@webrtc.org | fe19699 | 2015-02-07 22:35:54 +0000 | [diff] [blame] | 16 | #include "webrtc/system_wrappers/source/rw_lock_win.h" |
tommi | 61046eb | 2016-01-19 02:59:56 -0800 | [diff] [blame^] | 17 | #include "webrtc/system_wrappers/source/rw_lock_winxp_win.h" |
tommi@webrtc.org | fe19699 | 2015-02-07 22:35:54 +0000 | [diff] [blame] | 18 | #else |
| 19 | #include "webrtc/system_wrappers/source/rw_lock_posix.h" |
| 20 | #endif |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 21 | |
| 22 | namespace webrtc { |
henrike@webrtc.org | 9f84723 | 2012-09-25 20:27:51 +0000 | [diff] [blame] | 23 | |
pbos@webrtc.org | 7502543 | 2015-02-06 08:32:32 +0000 | [diff] [blame] | 24 | RWLockWrapper* RWLockWrapper::CreateRWLock() { |
tommi@webrtc.org | fe19699 | 2015-02-07 22:35:54 +0000 | [diff] [blame] | 25 | #ifdef _WIN32 |
| 26 | // Native implementation is faster, so use that if available. |
| 27 | RWLockWrapper* lock = RWLockWin::Create(); |
| 28 | if (lock) { |
| 29 | return lock; |
| 30 | } |
tommi | 61046eb | 2016-01-19 02:59:56 -0800 | [diff] [blame^] | 31 | return new RWLockWinXP(); |
tommi@webrtc.org | fe19699 | 2015-02-07 22:35:54 +0000 | [diff] [blame] | 32 | #else |
| 33 | return RWLockPosix::Create(); |
| 34 | #endif |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 35 | } |
| 36 | |
henrike@webrtc.org | 9f84723 | 2012-09-25 20:27:51 +0000 | [diff] [blame] | 37 | } // namespace webrtc |