Explicitly pass Thread::Current to MutexLock and Alloc.
Change-Id: I8b75bc0617915465f102815b32306aa7760dcae4
diff --git a/src/mutex.h b/src/mutex.h
index 32aeaf9..d51e2cc 100644
--- a/src/mutex.h
+++ b/src/mutex.h
@@ -25,8 +25,8 @@
#include "globals.h"
#include "locks.h"
+#include "logging.h"
#include "macros.h"
-#include "thread.h"
#if defined(__APPLE__)
#define ART_USE_FUTEXES 0
@@ -43,6 +43,8 @@
namespace art {
+class Thread;
+
const bool kDebugLocking = kIsDebugBuild;
// Base class for all Mutex implementations
@@ -110,7 +112,6 @@
}
}
void AssertHeld(const Thread* self) { AssertExclusiveHeld(self); }
- void AssertHeld() { AssertExclusiveHeld(Thread::Current()); }
// Assert that the Mutex is not held by the current thread.
void AssertNotHeldExclusive(const Thread* self) {
@@ -275,10 +276,6 @@
mu_.ExclusiveLock(self_);
}
- explicit MutexLock(Mutex& mu) EXCLUSIVE_LOCK_FUNCTION(mu) : self_(Thread::Current()), mu_(mu) {
- mu_.ExclusiveLock(self_);
- }
-
~MutexLock() UNLOCK_FUNCTION() {
mu_.ExclusiveUnlock(self_);
}
@@ -300,11 +297,6 @@
mu_.SharedLock(self_);
}
- explicit ReaderMutexLock(ReaderWriterMutex& mu) EXCLUSIVE_LOCK_FUNCTION(mu) :
- self_(Thread::Current()), mu_(mu) {
- mu_.SharedLock(self_);
- }
-
~ReaderMutexLock() UNLOCK_FUNCTION() {
mu_.SharedUnlock(self_);
}
@@ -327,17 +319,12 @@
mu_.ExclusiveLock(self_);
}
- explicit WriterMutexLock(ReaderWriterMutex& mu) EXCLUSIVE_LOCK_FUNCTION(mu) :
- self_(Thread::Current()), mu_(mu) {
- mu_.ExclusiveLock(self_);
- }
-
~WriterMutexLock() UNLOCK_FUNCTION() {
mu_.ExclusiveUnlock(self_);
}
private:
- Thread* self_;
+ Thread* const self_;
ReaderWriterMutex& mu_;
DISALLOW_COPY_AND_ASSIGN(WriterMutexLock);
};