Fix a deadlock in the CC collector.
Fix a deadlock between CC GC disabling system weaks and thread attach.
See 31500969#2 for more details.
Bug: 31500969
Bug: 12687968
Test: test-art-host with CC. N9 libartd boot. Ritz EAAC.
Change-Id: Ic9a8bfb1c636643a03f4580b811fe890273576b6
diff --git a/runtime/thread_list.h b/runtime/thread_list.h
index 5880085..5a01399 100644
--- a/runtime/thread_list.h
+++ b/runtime/thread_list.h
@@ -94,8 +94,10 @@
// Run a checkpoint on threads, running threads are not suspended but run the checkpoint inside
// of the suspend check. Returns how many checkpoints that are expected to run, including for
- // already suspended threads for b/24191051.
- size_t RunCheckpoint(Closure* checkpoint_function)
+ // already suspended threads for b/24191051. Run the callback, if non-null, inside the
+ // thread_list_lock critical section after determining the runnable/suspended states of the
+ // threads.
+ size_t RunCheckpoint(Closure* checkpoint_function, Closure* callback = nullptr)
REQUIRES(!Locks::thread_list_lock_, !Locks::thread_suspend_count_lock_);
size_t RunCheckpointOnRunnableThreads(Closure* checkpoint_function)