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

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

Issue 1860353002: Remove XP Condition Variable Affordances (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change declaration order 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/condition_variable_win.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
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_H_ 5 #ifndef BASE_SYNCHRONIZATION_LOCK_H_
6 #define BASE_SYNCHRONIZATION_LOCK_H_ 6 #define BASE_SYNCHRONIZATION_LOCK_H_
7 7
8 #include "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 bool rv = lock_.Try(); 54 bool rv = lock_.Try();
55 if (rv) { 55 if (rv) {
56 CheckUnheldAndMark(); 56 CheckUnheldAndMark();
57 } 57 }
58 return rv; 58 return rv;
59 } 59 }
60 60
61 void AssertAcquired() const; 61 void AssertAcquired() const;
62 #endif // DCHECK_IS_ON() 62 #endif // DCHECK_IS_ON()
63 63
64 #if defined(OS_POSIX) 64 #if defined(OS_POSIX) || defined(OS_WIN)
65 // The posix implementation of ConditionVariable needs to be able 65 // Both Windows and POSIX implementations of ConditionVariable need to be
66 // to see our lock and tweak our debugging counters, as it releases 66 // able to see our lock and tweak our debugging counters, as they release and
67 // and acquires locks inside of pthread_cond_{timed,}wait. 67 // acquire locks inside of their condition variable APIs.
68 friend class ConditionVariable; 68 friend class ConditionVariable;
69 #elif defined(OS_WIN)
70 // The Windows Vista implementation of ConditionVariable needs the
71 // native handle of the critical section.
72 friend class WinVistaCondVar;
73 #endif 69 #endif
74 70
75 private: 71 private:
76 #if DCHECK_IS_ON() 72 #if DCHECK_IS_ON()
77 // Members and routines taking care of locks assertions. 73 // Members and routines taking care of locks assertions.
78 // Note that this checks for recursive locks and allows them 74 // Note that this checks for recursive locks and allows them
79 // if the variable is set. This is allowed by the underlying implementation 75 // if the variable is set. This is allowed by the underlying implementation
80 // on windows but not on Posix, so we're doing unneeded checks on Posix. 76 // on windows but not on Posix, so we're doing unneeded checks on Posix.
81 // It's worth it to share the code. 77 // It's worth it to share the code.
82 void CheckHeldAndUnmark(); 78 void CheckHeldAndUnmark();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 127 }
132 128
133 private: 129 private:
134 Lock& lock_; 130 Lock& lock_;
135 DISALLOW_COPY_AND_ASSIGN(AutoUnlock); 131 DISALLOW_COPY_AND_ASSIGN(AutoUnlock);
136 }; 132 };
137 133
138 } // namespace base 134 } // namespace base
139 135
140 #endif // BASE_SYNCHRONIZATION_LOCK_H_ 136 #endif // BASE_SYNCHRONIZATION_LOCK_H_
OLDNEW
« no previous file with comments | « base/synchronization/condition_variable_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698