Use WaitHoldingLocks in ReferenceProcessor::GetReferent.
The caller may be holding other locks, so we must use this or else
we get bad mutexes held errors. Also added a lock level for the
reference processor.
Change-Id: I364a303a4106982bd9bfaac5b116cea1638ea6d3
diff --git a/runtime/gc/reference_processor.cc b/runtime/gc/reference_processor.cc
index ef9e1d4..188b6b3 100644
--- a/runtime/gc/reference_processor.cc
+++ b/runtime/gc/reference_processor.cc
@@ -28,7 +28,7 @@
ReferenceProcessor::ReferenceProcessor()
: process_references_args_(nullptr, nullptr, nullptr), slow_path_enabled_(false),
- preserving_references_(false), lock_("reference processor lock"),
+ preserving_references_(false), lock_("reference processor lock", kReferenceProcessorLock),
condition_("reference processor condition", lock_) {
}
@@ -71,7 +71,7 @@
return obj;
}
}
- condition_.Wait(self);
+ condition_.WaitHoldingLocks(self);
}
return reference->GetReferent();
}