diff options
author | 2023-09-09 23:19:28 +0000 | |
---|---|---|
committer | 2023-09-09 23:19:28 +0000 | |
commit | a43e67ea1a314e5c6faf77457ffc5ea39c24d4ca (patch) | |
tree | 9ffb0fce0deed66670477257567bd9a617449105 /runtime/base/mutex.h | |
parent | f9fdd3ce0180972dc8d4f0c8410ea7702828a703 (diff) |
Revert "Revert^14 "Thread suspension cleanup and deadlock fix""
This reverts commit f9fdd3ce0180972dc8d4f0c8410ea7702828a703.
Reason for revert: Very suspicious host-x86_64-debug failure on LUCI.
Change-Id: Ia01dd3df8d64d6bc0d12319b06a8380f64a46785
Diffstat (limited to 'runtime/base/mutex.h')
-rw-r--r-- | runtime/base/mutex.h | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/runtime/base/mutex.h b/runtime/base/mutex.h index 925f7a2f45..87e9525557 100644 --- a/runtime/base/mutex.h +++ b/runtime/base/mutex.h @@ -103,11 +103,10 @@ class BaseMutex { BaseMutex(const char* name, LockLevel level); virtual ~BaseMutex(); - // Add this mutex to those owned by self, and optionally perform lock order checking. Caller - // may wish to disable checking for trylock calls that cannot result in deadlock. For this call - // only, self may also be another suspended thread. - void RegisterAsLocked(Thread* self, bool check = kDebugLocking); - void RegisterAsLockedImpl(Thread* self, LockLevel level, bool check); + // Add this mutex to those owned by self, and perform appropriate checking. + // For this call only, self may also be another suspended thread. + void RegisterAsLocked(Thread* self); + void RegisterAsLockedImpl(Thread* self, LockLevel level); void RegisterAsUnlocked(Thread* self); void RegisterAsUnlockedImpl(Thread* self, LockLevel level); @@ -184,10 +183,7 @@ class LOCKABLE Mutex : public BaseMutex { void ExclusiveLock(Thread* self) ACQUIRE(); void Lock(Thread* self) ACQUIRE() { ExclusiveLock(self); } - // Returns true if acquires exclusive access, false otherwise. The `check` argument specifies - // whether lock level checking should be performed. Should be defaulted unless we are using - // TryLock instead of Lock for deadlock avoidance. - template <bool kCheck = kDebugLocking> + // Returns true if acquires exclusive access, false otherwise. bool ExclusiveTryLock(Thread* self) TRY_ACQUIRE(true); bool TryLock(Thread* self) TRY_ACQUIRE(true) { return ExclusiveTryLock(self); } // Equivalent to ExclusiveTryLock, but retry for a short period before giving up. @@ -346,7 +342,7 @@ class SHARED_LOCKABLE ReaderWriterMutex : public BaseMutex { void ReaderLock(Thread* self) ACQUIRE_SHARED() { SharedLock(self); } // Try to acquire share of ReaderWriterMutex. - bool SharedTryLock(Thread* self, bool check = kDebugLocking) SHARED_TRYLOCK_FUNCTION(true); + bool SharedTryLock(Thread* self) SHARED_TRYLOCK_FUNCTION(true); // Release a share of the access. void SharedUnlock(Thread* self) RELEASE_SHARED() ALWAYS_INLINE; |