| Index: base/synchronization/lock.h
|
| diff --git a/base/synchronization/lock.h b/base/synchronization/lock.h
|
| index c2680cbcc8a145be5ce3556a76e071e595997d7a..599984e8b6dc509de30b4426e166fdb42e82b63b 100644
|
| --- a/base/synchronization/lock.h
|
| +++ b/base/synchronization/lock.h
|
| @@ -61,13 +61,22 @@ class BASE_EXPORT Lock {
|
| void AssertAcquired() const;
|
| #endif // DCHECK_IS_ON()
|
|
|
| + // Whether Lock mitigates priority inversion when used from different thread
|
| + // priorities.
|
| + 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() {
|
| + // POSIX mitigates priority inversion by setting the priority of a thread
|
| + // holding a Lock to the maximum priority of any other thread waiting on it.
|
| 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
|
| #endif
|
| + }
|
|
|
| #if defined(OS_POSIX) || defined(OS_WIN)
|
| // Both Windows and POSIX implementations of ConditionVariable need to be
|
|
|