Skip to content

Commit

Permalink
Merge pull request #16787 from babsingh/jvmtiGetVirtualThread_fix
Browse files Browse the repository at this point in the history
Fix jvmtiGetVirtualThread and make it more robust
  • Loading branch information
gacholio authored Mar 1, 2023
2 parents 69b614e + 86709c3 commit 8078ad6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions runtime/jvmti/jvmtiExtensionMechanism.c
Original file line number Diff line number Diff line change
Expand Up @@ -3805,10 +3805,14 @@ jvmtiGetVirtualThread(jvmtiEnv* jvmti_env, ...)
currentThread, carrier_thread, &targetThread, JVMTI_ERROR_NONE,
J9JVMTI_GETVMTHREAD_ERROR_ON_DEAD_THREAD);
if (JVMTI_ERROR_NONE == rc) {
if (NULL != targetThread->threadObject) {
j9object_t threadObject = targetThread->threadObject;
j9object_t carrierThreadObject = targetThread->carrierThreadObject;
if ((NULL != threadObject)
&& (threadObject != carrierThreadObject)
) {
rv_virtual_thread = (jthread)vm->internalVMFunctions->j9jni_createLocalRef(
(JNIEnv *)currentThread,
(j9object_t)targetThread->threadObject);
(j9object_t)threadObject);
}
releaseVMThread(currentThread, targetThread, carrier_thread);
}
Expand Down

0 comments on commit 8078ad6

Please sign in to comment.