From 1d8a9741d2979d09a21942fbf9107d212ce2511b Mon Sep 17 00:00:00 2001 From: Alex Light Date: Thu, 17 Aug 2017 11:12:06 -0700 Subject: Fix interaction of VMInit and ThreadStart events. Real world agents require that one is able to create, and run, new threads while the VMInit event is still being executed. Further, these require that ThreadStart events can occur concurrently with the VMInit event. This CL enables this behavior and adds a test for the interaction of these two events. Test: ./test.py --host -j50 Bug: 62821960 Bug: 34415266 Change-Id: I305f1ce3f1df9bf5a7e33027e0724f5fbac5c0f1 --- openjdkjvmti/ti_thread.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'openjdkjvmti/ti_thread.h') diff --git a/openjdkjvmti/ti_thread.h b/openjdkjvmti/ti_thread.h index 03c49d7788..a19974aa16 100644 --- a/openjdkjvmti/ti_thread.h +++ b/openjdkjvmti/ti_thread.h @@ -53,9 +53,14 @@ class ThreadUtil { static void Register(EventHandler* event_handler); static void Unregister(); - // To be called when it is safe to cache data. + // To be called when it is safe to cache data. This means that we have at least entered the + // RuntimePhase::kInit but we might or might not have already called VMInit event. static void CacheData(); + // Called just after we have sent the VMInit callback so that ThreadUtil can do final setup. This + // ensures that there are no timing issues between the two callbacks. + static void VMInitEventSent() REQUIRES_SHARED(art::Locks::mutator_lock_); + // Handle a jvmtiEnv going away. static void RemoveEnvironment(jvmtiEnv* env); -- cgit v1.2.3-59-g8ed1b