Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: base/synchronization/read_write_lock_win.cc

Issue 1988563002: Create a reader-writer lock implementaiton in base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move to base::subtle and add a warning Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/synchronization/read_write_lock_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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/read_write_lock.h"
6
7 namespace base {
8 namespace subtle {
9
10 ReadWriteLock::ReadWriteLock() : native_handle_(SRWLOCK_INIT) {}
11
12 ReadWriteLock::~ReadWriteLock() = default;
13
14 void ReadWriteLock::ReadAcquire() {
15 ::AcquireSRWLockShared(&native_handle_);
16 }
17
18 void ReadWriteLock::ReadRelease() {
19 ::ReleaseSRWLockShared(&native_handle_);
20 }
21
22 void ReadWriteLock::WriteAcquire() {
23 ::AcquireSRWLockExclusive(&native_handle_);
24 }
25
26 void ReadWriteLock::WriteRelease() {
27 ::ReleaseSRWLockExclusive(&native_handle_);
28 }
29
30 } // namespace subtle
31 } // namespace base
OLDNEW
« no previous file with comments | « base/synchronization/read_write_lock_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698