OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/synchronization/rw_lock.h" |
| 6 |
| 7 namespace base { |
| 8 |
| 9 RWLock::RWLock() : native_handle_(SRWLOCK_INIT) {} |
| 10 |
| 11 RWLock::~RWLock() = default; |
| 12 |
| 13 void RWLock::ReadAcquire() { |
| 14 ::AcquireSRWLockShared(&native_handle_); |
| 15 } |
| 16 |
| 17 void RWLock::ReadRelease() { |
| 18 ::ReleaseSRWLockShared(&native_handle_); |
| 19 } |
| 20 |
| 21 void RWLock::WriteAcquire() { |
| 22 ::AcquireSRWLockExclusive(&native_handle_); |
| 23 } |
| 24 |
| 25 void RWLock::WriteRelease() { |
| 26 ::ReleaseSRWLockExclusive(&native_handle_); |
| 27 } |
| 28 |
| 29 } // namespace base |
OLD | NEW |