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

Side by Side Diff: base/synchronization/lock_impl.h

Issue 1864323002: Migrate from CRITICAL_SECTION to SRWLOCK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cv
Patch Set: Update Comment Created 4 years, 8 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/lock.h ('k') | base/synchronization/lock_impl_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_SYNCHRONIZATION_LOCK_IMPL_H_ 5 #ifndef BASE_SYNCHRONIZATION_LOCK_IMPL_H_
6 #define BASE_SYNCHRONIZATION_LOCK_IMPL_H_ 6 #define BASE_SYNCHRONIZATION_LOCK_IMPL_H_
7 7
8 #include "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 11
12 #if defined(OS_WIN) 12 #if defined(OS_WIN)
13 #include <windows.h> 13 #include <windows.h>
14 #elif defined(OS_POSIX) 14 #elif defined(OS_POSIX)
15 #include <pthread.h> 15 #include <pthread.h>
16 #endif 16 #endif
17 17
18 namespace base { 18 namespace base {
19 namespace internal { 19 namespace internal {
20 20
21 // This class implements the underlying platform-specific spin-lock mechanism 21 // This class implements the underlying platform-specific spin-lock mechanism
22 // used for the Lock class. Most users should not use LockImpl directly, but 22 // used for the Lock class. Most users should not use LockImpl directly, but
23 // should instead use Lock. 23 // should instead use Lock.
24 class BASE_EXPORT LockImpl { 24 class BASE_EXPORT LockImpl {
25 public: 25 public:
26 #if defined(OS_WIN) 26 #if defined(OS_WIN)
27 typedef CRITICAL_SECTION NativeHandle; 27 using NativeHandle = SRWLOCK;
28 #elif defined(OS_POSIX) 28 #elif defined(OS_POSIX)
29 typedef pthread_mutex_t NativeHandle; 29 using NativeHandle = pthread_mutex_t;
30 #endif 30 #endif
31 31
32 LockImpl(); 32 LockImpl();
33 ~LockImpl(); 33 ~LockImpl();
34 34
35 // If the lock is not held, take it and return true. If the lock is already 35 // If the lock is not held, take it and return true. If the lock is already
36 // held by something else, immediately return false. 36 // held by something else, immediately return false.
37 bool Try(); 37 bool Try();
38 38
39 // Take the lock, blocking until it is available if necessary. 39 // Take the lock, blocking until it is available if necessary.
(...skipping 11 matching lines...) Expand all
51 private: 51 private:
52 NativeHandle native_handle_; 52 NativeHandle native_handle_;
53 53
54 DISALLOW_COPY_AND_ASSIGN(LockImpl); 54 DISALLOW_COPY_AND_ASSIGN(LockImpl);
55 }; 55 };
56 56
57 } // namespace internal 57 } // namespace internal
58 } // namespace base 58 } // namespace base
59 59
60 #endif // BASE_SYNCHRONIZATION_LOCK_IMPL_H_ 60 #endif // BASE_SYNCHRONIZATION_LOCK_IMPL_H_
OLDNEW
« no previous file with comments | « base/synchronization/lock.h ('k') | base/synchronization/lock_impl_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698