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

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

Issue 2692273008: Hacky slashy (Closed)
Patch Set: wip Created 3 years, 10 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
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 static bool HandlesMultipleThreadPriorities() { 66 static bool HandlesMultipleThreadPriorities() {
67 #if defined(OS_POSIX) 67 #if defined(OS_POSIX)
68 // POSIX mitigates priority inversion by setting the priority of a thread 68 // POSIX mitigates priority inversion by setting the priority of a thread
69 // holding a Lock to the maximum priority of any other thread waiting on it. 69 // holding a Lock to the maximum priority of any other thread waiting on it.
70 return internal::LockImpl::PriorityInheritanceAvailable(); 70 return internal::LockImpl::PriorityInheritanceAvailable();
71 #elif defined(OS_WIN) 71 #elif defined(OS_WIN)
72 // Windows mitigates priority inversion by randomly boosting the priority of 72 // Windows mitigates priority inversion by randomly boosting the priority of
73 // ready threads. 73 // ready threads.
74 // https://msdn.microsoft.com/library/windows/desktop/ms684831.aspx 74 // https://msdn.microsoft.com/library/windows/desktop/ms684831.aspx
75 return true; 75 return true;
76 #elif defined(OS_FUCHSIA)
77 return false;
76 #else 78 #else
77 #error Unsupported platform 79 #error Unsupported platform
78 #endif 80 #endif
79 } 81 }
80 82
81 #if defined(OS_POSIX) || defined(OS_WIN) 83 #if defined(OS_POSIX) || defined(OS_WIN)
82 // Both Windows and POSIX implementations of ConditionVariable need to be 84 // Both Windows and POSIX implementations of ConditionVariable need to be
83 // able to see our lock and tweak our debugging counters, as they release and 85 // able to see our lock and tweak our debugging counters, as they release and
84 // acquire locks inside of their condition variable APIs. 86 // acquire locks inside of their condition variable APIs.
85 friend class ConditionVariable; 87 friend class ConditionVariable;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 146 }
145 147
146 private: 148 private:
147 Lock& lock_; 149 Lock& lock_;
148 DISALLOW_COPY_AND_ASSIGN(AutoUnlock); 150 DISALLOW_COPY_AND_ASSIGN(AutoUnlock);
149 }; 151 };
150 152
151 } // namespace base 153 } // namespace base
152 154
153 #endif // BASE_SYNCHRONIZATION_LOCK_H_ 155 #endif // BASE_SYNCHRONIZATION_LOCK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698