comparison src/share/vm/prims/jvmtiEventController.cpp @ 2126:db2b0f8c1cef

6814943: getcpool001 catches more than one JvmtiThreadState problem Summary: Mark field volatile, use membars, and change access order to close race Reviewed-by: dcubed, dholmes
author kamg
date Tue, 11 Jan 2011 10:06:00 -0500
parents f95d63e2154a
children 1d1603768966
comparison
equal deleted inserted replaced
2125:7246a374a9f2 2126:db2b0f8c1cef
665 665
666 void 666 void
667 JvmtiEventControllerPrivate::thread_ended(JavaThread *thread) { 667 JvmtiEventControllerPrivate::thread_ended(JavaThread *thread) {
668 // Removes the JvmtiThreadState associated with the specified thread. 668 // Removes the JvmtiThreadState associated with the specified thread.
669 // May be called after all environments have been disposed. 669 // May be called after all environments have been disposed.
670 assert(JvmtiThreadState_lock->is_locked(), "sanity check");
670 671
671 EC_TRACE(("JVMTI [%s] # thread ended", JvmtiTrace::safe_get_thread_name(thread))); 672 EC_TRACE(("JVMTI [%s] # thread ended", JvmtiTrace::safe_get_thread_name(thread)));
672 673
673 JvmtiThreadState *state = thread->jvmti_thread_state(); 674 JvmtiThreadState *state = thread->jvmti_thread_state();
674 if (state != NULL) { 675 assert(state != NULL, "else why are we here?");
675 MutexLocker mu(JvmtiThreadState_lock); 676 delete state;
676 delete state;
677 }
678 } 677 }
679 678
680 void JvmtiEventControllerPrivate::set_event_callbacks(JvmtiEnvBase *env, 679 void JvmtiEventControllerPrivate::set_event_callbacks(JvmtiEnvBase *env,
681 const jvmtiEventCallbacks* callbacks, 680 const jvmtiEventCallbacks* callbacks,
682 jint size_of_callbacks) { 681 jint size_of_callbacks) {