Use WaitHoldingLocks in ReferenceProcessor::MakeCircularListIfUnenqueued.
The caller may be holding mutator_lock_, so we must use WaitHoldingLocks.
Otherwise we get 'bad_mutexes_held' error with debug build.
See also https://android-review.googlesource.com/#/c/93892.
Change-Id: I87b1119e22a9934fdc622c4c4e2690b8b552b539
Signed-off-by: Pavel Vyssotski <pavel.n.vyssotski@intel.com>
diff --git a/runtime/gc/reference_processor.cc b/runtime/gc/reference_processor.cc
index 012f9f9..99bd63f 100644
--- a/runtime/gc/reference_processor.cc
+++ b/runtime/gc/reference_processor.cc
@@ -234,7 +234,7 @@
MutexLock mu(self, *Locks::reference_processor_lock_);
// Wait untul we are done processing reference.
while (SlowPathEnabled()) {
- condition_.Wait(self);
+ condition_.WaitHoldingLocks(self);
}
// At this point, since the sentinel of the reference is live, it is guaranteed to not be
// enqueued if we just finished processing references. Otherwise, we may be doing the main GC