Chromium Code Reviews| Index: base/synchronization/lock.h |
| diff --git a/base/synchronization/lock.h b/base/synchronization/lock.h |
| index c2680cbcc8a145be5ce3556a76e071e595997d7a..b8dd971f30571fa5129c844c10f4634285723f68 100644 |
| --- a/base/synchronization/lock.h |
| +++ b/base/synchronization/lock.h |
| @@ -61,13 +61,23 @@ class BASE_EXPORT Lock { |
| void AssertAcquired() const; |
| #endif // DCHECK_IS_ON() |
| + // Whether Lock mitigates priority inversion when used from different thread |
| + // priorities. Priority inversion is mitigated by allowing a thread that holds |
| + // a Lock to run when higher priority threads try to acquire it. Note that a |
| + // low priority thread can still prevent high priority threads to run for an |
| + // unbounded amount of time by holding a Lock. |
|
gab
2016/08/03 18:47:25
Hmmm? Unbounded? The whole point here I thought wa
robliao
2016/08/03 19:17:15
It will be readied, but if it's doing a really lon
fdoray
2016/08/03 19:24:09
Done. Removed last sentence because it is true reg
|
| + static bool HandlesMultipleThreadPriorities() { |
| #if defined(OS_POSIX) |
| - // Whether this platform has priority inheritance available. All locks will |
| - // attempt to use the priority inheritance version if available. |
| - static bool PriorityInheritanceAvailable() { |
| return internal::LockImpl::PriorityInheritanceAvailable(); |
| - } |
| +#elif defined(OS_WIN) |
| + // Windows mitigates priority inversion by randomly boosting the priority of |
| + // ready threads. |
| + // https://msdn.microsoft.com/library/windows/desktop/ms684831.aspx |
| + return true; |
| +#else |
| + #error "Unsupported platform" |
|
gab
2016/08/03 18:47:25
nit: no indent for preprocessor commands
robliao
2016/08/03 19:17:15
Maybe "Unsupported platform. Must specify if the l
fdoray
2016/08/03 19:24:09
Done.
fdoray
2016/08/03 19:24:09
Done.
|
| #endif |
| + } |
| #if defined(OS_POSIX) || defined(OS_WIN) |
| // Both Windows and POSIX implementations of ConditionVariable need to be |