Fix deadlock in ThreadList::RunCheckpoint().

Be smarter about the situation when a thread races the
suspend request to become Runnable. In that case we try to
reschedule the checkpoint on that thread and, if successful,
we clear the suspend request. Thus we never have to wait for
a Runnable thread to become suspended.

This avoids a deadlock where the ThreadList::RunCheckpoint()
was waiting for a Runnable thread which was waiting for the
GC to allow weak ref access while the GC thread was actually
suspended by the suspend request, trying to become Runnable.

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing --jit --interpreter
Bug: 138852758
Change-Id: I746b00160e09ac9e55ee6214faee6447025615b9
1 file changed