summaryrefslogtreecommitdiff
path: root/runtime/base/mutex.h
diff options
context:
space:
mode:
author Hans Boehm <hboehm@google.com> 2022-10-13 02:47:24 +0000
committer Hans Boehm <hboehm@google.com> 2022-10-13 02:47:24 +0000
commitebd76406bf5fa74185998bc29f0f27c20fa2e683 (patch)
treebeec1accc089bbbc432a140dfebe28bb7278a909 /runtime/base/mutex.h
parentfd20a745227aa7cae7a08728bb29e5bfce64ea87 (diff)
Revert "Revert^2 "Thread suspension cleanup and deadlock fix""
This reverts commit fd20a745227aa7cae7a08728bb29e5bfce64ea87. Reason for revert: Lots of libartd failures due to new checkpoint lock level check. Change-Id: I0cf88ff893f8743a9a830a49489807d0921199a3
Diffstat (limited to 'runtime/base/mutex.h')
-rw-r--r--runtime/base/mutex.h14
1 files changed, 5 insertions, 9 deletions
diff --git a/runtime/base/mutex.h b/runtime/base/mutex.h
index 407effeab6..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 check = 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.