diff options
Diffstat (limited to 'openjdkjvmti/ti_thread.h')
-rw-r--r-- | openjdkjvmti/ti_thread.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/openjdkjvmti/ti_thread.h b/openjdkjvmti/ti_thread.h index 09b4cabcfc..341bffe51e 100644 --- a/openjdkjvmti/ti_thread.h +++ b/openjdkjvmti/ti_thread.h @@ -42,6 +42,7 @@ namespace art { class ArtField; class ScopedObjectAccessAlreadyRunnable; class Thread; +class Closure; } // namespace art namespace openjdkjvmti { @@ -133,6 +134,16 @@ class ThreadUtil { REQUIRES(!art::Locks::user_code_suspension_lock_, !art::Locks::thread_suspend_count_lock_); + // This will request a synchronous checkpoint in such a way as to prevent gc races if a local + // variable is taken from one thread's stack and placed in the stack of another thread. + // RequestSynchronousCheckpoint releases the thread_list_lock_ as a part of its execution. This is + // due to the fact that Thread::Current() needs to go to sleep to allow the targeted thread to + // execute the checkpoint for us if it is Runnable. + static bool RequestGCSafeSynchronousCheckpoint(art::Thread* thr, art::Closure* function) + REQUIRES_SHARED(art::Locks::mutator_lock_) + RELEASE(art::Locks::thread_list_lock_) + REQUIRES(!art::Locks::thread_suspend_count_lock_); + private: // We need to make sure only one thread tries to suspend threads at a time so we can get the // 'suspend-only-once' behavior the spec requires. Internally, ART considers suspension to be a |