BaseMutex::IsExclusiveHeld should only be called on self.
Fix issue in Thread::DumpState of lock dumping calling IsExclusiveHeld on a
thread that isn't self causing intermittent crashes of ThreadStress oat test.
Bug: 15446488
Change-Id: I86924397a4e21ce10a95ea2a737d7bfbcb8ffe28
diff --git a/runtime/thread.cc b/runtime/thread.cc
index d3487d0..d60fb49 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -835,10 +835,9 @@
os << " \"" << mutex->GetName() << "\"";
if (mutex->IsReaderWriterMutex()) {
ReaderWriterMutex* rw_mutex = down_cast<ReaderWriterMutex*>(mutex);
- if (rw_mutex->IsExclusiveHeld(thread)) {
+ if (rw_mutex->GetExclusiveOwnerTid() == static_cast<uint64_t>(tid)) {
os << "(exclusive held)";
} else {
- CHECK(rw_mutex->IsSharedHeld(thread));
os << "(shared held)";
}
}