Chromium Code Reviews| Index: base/synchronization/lock.h |
| diff --git a/base/synchronization/lock.h b/base/synchronization/lock.h |
| index fbf6cef76911c80332da1524beeb23fd14737917..2ab28c608143c744e603a2d2feb5317fa950877b 100644 |
| --- a/base/synchronization/lock.h |
| +++ b/base/synchronization/lock.h |
| @@ -14,6 +14,19 @@ |
| namespace base { |
| +#if defined(OS_POSIX) |
| + |
| +// Determines which platforms can consider using priority inheritance locks. If |
| +// priority inheritance is possible, it does not necessarily mean it's |
| +// available. Lock::PriorityInheritanceAvailable must still be checked. |
|
gab
2016/06/07 12:28:18
Why not have everyone go through the method and en
robliao
2016/06/07 14:11:04
A couple of reasons:
1) Callers who care about thi
|
| +#if defined(OS_NACL) || defined(OS_ANDROID) |
| +#define PRIORITY_INHERITANCE_LOCKS_POSSIBLE() 0 |
| +#else |
| +#define PRIORITY_INHERITANCE_LOCKS_POSSIBLE() 1 |
| +#endif |
| + |
| +#endif |
| + |
| // A convenient wrapper for an OS specific critical section. The only real |
| // intelligence in this class is in debug mode for the support for the |
| // AssertAcquired() method. |
| @@ -61,6 +74,14 @@ class BASE_EXPORT Lock { |
| void AssertAcquired() const; |
| #endif // DCHECK_IS_ON() |
| +#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(); |
| + } |
| +#endif |
| + |
| #if defined(OS_POSIX) || defined(OS_WIN) |
| // Both Windows and POSIX implementations of ConditionVariable need to be |
| // able to see our lock and tweak our debugging counters, as they release and |