Previously, if a concurrent GC was in-flight when an explicit GC was
requested a warning would be logged about a recursive GC attempt. Now,
the requesting thread will block until the GC is inactive and afterward
initiate its foreground collection.
Change-Id: Ibc4cef83315ffe7ccf822a32beb4cce5b1c816bd
void dvmCollectGarbage(bool collectSoftReferences)
{
dvmLockHeap();
-
+ while (gDvm.gcHeap->gcRunning) {
+ dvmWaitForConcurrentGcToComplete();
+ }
dvmCollectGarbageInternal(collectSoftReferences, GC_EXPLICIT);
-
dvmUnlockHeap();
}