Add more logging to Mutex::ExclusiveUnlock
Bug: 18713034
Change-Id: I9db5ca0a25592714ac9e292a2b8d46ef73779c8b
diff --git a/runtime/base/mutex.cc b/runtime/base/mutex.cc
index da78082..a4eb318 100644
--- a/runtime/base/mutex.cc
+++ b/runtime/base/mutex.cc
@@ -434,7 +434,17 @@
}
void Mutex::ExclusiveUnlock(Thread* self) {
- DCHECK(self == NULL || self == Thread::Current());
+ if (kIsDebugBuild && self != nullptr && self != Thread::Current()) {
+ std::string name1 = "<null>";
+ std::string name2 = "<null>";
+ if (self != nullptr) {
+ self->GetThreadName(name1);
+ }
+ if (Thread::Current() != nullptr) {
+ Thread::Current()->GetThreadName(name2);
+ }
+ LOG(FATAL) << name1 << " " << name2;
+ }
AssertHeld(self);
DCHECK_NE(exclusive_owner_, 0U);
recursion_count_--;