Ensure that updates to the global event mask are atomic

We were setting and testing the global event mask in a way that
allowed races with other threads. This could cause issues if multiple
threads write to the mask at the same time and could cause changes to
the current event state to be missed.

Test: ./test.py --host -j50
Bug: 69657830
Change-Id: I5e2759af598e6179fd25fcbe6b211a9369217156
diff --git a/openjdkjvmti/events.h b/openjdkjvmti/events.h
index c73215f..d21a587 100644
--- a/openjdkjvmti/events.h
+++ b/openjdkjvmti/events.h
@@ -149,8 +149,16 @@
 
   EventMask& GetEventMask(art::Thread* thread);
   EventMask* GetEventMaskOrNull(art::Thread* thread);
-  void EnableEvent(art::Thread* thread, ArtJvmtiEvent event);
-  void DisableEvent(art::Thread* thread, ArtJvmtiEvent event);
+  // Circular dependencies mean we cannot see the definition of ArtJvmTiEnv so the mutex is simply
+  // asserted in the function.
+  // Note that the 'env' passed in must be the same env this EventMasks is associated with.
+  void EnableEvent(ArtJvmTiEnv* env, art::Thread* thread, ArtJvmtiEvent event);
+      // REQUIRES(env->event_info_mutex_);
+  // Circular dependencies mean we cannot see the definition of ArtJvmTiEnv so the mutex is simply
+  // asserted in the function.
+  // Note that the 'env' passed in must be the same env this EventMasks is associated with.
+  void DisableEvent(ArtJvmTiEnv* env, art::Thread* thread, ArtJvmtiEvent event);
+      // REQUIRES(env->event_info_mutex_);
   bool IsEnabledAnywhere(ArtJvmtiEvent event);
   // Make any changes to event masks needed for the given capability changes. If caps_added is true
   // then caps is all the newly set capabilities of the jvmtiEnv. If it is false then caps is the