< prev index next >
test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003/suspendthrd003.cpp
Print this page
rev 52185 : [mq]: refactor
*** 61,72 ****
nsk_jvmti_threadByName(THREAD_NAME)) != NULL))
return;
NSK_DISPLAY1(" ... found thread: %p\n", (void*)testedThread);
NSK_DISPLAY1("Suspend thread: %p\n", (void*)testedThread);
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB2(SuspendThread, jvmti, testedThread))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY0("Let thread to run and finish\n");
--- 61,71 ----
nsk_jvmti_threadByName(THREAD_NAME)) != NULL))
return;
NSK_DISPLAY1(" ... found thread: %p\n", (void*)testedThread);
NSK_DISPLAY1("Suspend thread: %p\n", (void*)testedThread);
! if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(testedThread))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY0("Let thread to run and finish\n");
*** 76,87 ****
NSK_DISPLAY1("Get state vector for thread: %p\n", (void*)testedThread);
{
jint state = 0;
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB3(GetThreadState, jvmti, testedThread, &state))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY2(" ... got state vector: %s (%d)\n",
TranslateState(state), (int)state);
--- 75,85 ----
NSK_DISPLAY1("Get state vector for thread: %p\n", (void*)testedThread);
{
jint state = 0;
! if (!NSK_JVMTI_VERIFY(jvmti->GetThreadState(testedThread, &state))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY2(" ... got state vector: %s (%d)\n",
TranslateState(state), (int)state);
*** 92,103 ****
nsk_jvmti_setFailStatus();
}
}
NSK_DISPLAY1("Resume thread: %p\n", (void*)testedThread);
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB2(ResumeThread, jvmti, testedThread))) {
nsk_jvmti_setFailStatus();
}
/* Original agentProc test block ends here. */
/*
--- 90,100 ----
nsk_jvmti_setFailStatus();
}
}
NSK_DISPLAY1("Resume thread: %p\n", (void*)testedThread);
! if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(testedThread))) {
nsk_jvmti_setFailStatus();
}
/* Original agentProc test block ends here. */
/*
*** 105,126 ****
* in order to slow down the rate of SuspendThread() calls.
*/
for (late_count = 0; late_count < N_LATE_CALLS; late_count++) {
jvmtiError l_err;
printf("INFO: Late suspend thread: %p\n", (void*)testedThread);
! l_err = NSK_CPP_STUB2(SuspendThread, jvmti, testedThread);
if (l_err != JVMTI_ERROR_NONE) {
printf("INFO: Late suspend thread err: %d\n", l_err);
// testedThread has exited so we're done with late calls
break;
}
// Only resume a thread if suspend worked. Using NSK_DISPLAY1()
// here because we want ResumeThread() to be faster.
NSK_DISPLAY1("INFO: Late resume thread: %p\n", (void*)testedThread);
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB2(ResumeThread, jvmti, testedThread))) {
nsk_jvmti_setFailStatus();
}
}
printf("INFO: made %d late calls to JVM/TI SuspendThread()\n",
--- 102,122 ----
* in order to slow down the rate of SuspendThread() calls.
*/
for (late_count = 0; late_count < N_LATE_CALLS; late_count++) {
jvmtiError l_err;
printf("INFO: Late suspend thread: %p\n", (void*)testedThread);
! l_err = jvmti->SuspendThread(testedThread);
if (l_err != JVMTI_ERROR_NONE) {
printf("INFO: Late suspend thread err: %d\n", l_err);
// testedThread has exited so we're done with late calls
break;
}
// Only resume a thread if suspend worked. Using NSK_DISPLAY1()
// here because we want ResumeThread() to be faster.
NSK_DISPLAY1("INFO: Late resume thread: %p\n", (void*)testedThread);
! if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(testedThread))) {
nsk_jvmti_setFailStatus();
}
}
printf("INFO: made %d late calls to JVM/TI SuspendThread()\n",
*** 135,145 ****
// SP6.1-w - wait to end test
if (!nsk_jvmti_waitForSync(timeout))
return;
NSK_DISPLAY0("Delete thread reference\n");
! NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedThread));
}
NSK_DISPLAY0("Let debugee to finish\n");
// SP7.1-n - notify agent end
if (!nsk_jvmti_resumeSync())
--- 131,141 ----
// SP6.1-w - wait to end test
if (!nsk_jvmti_waitForSync(timeout))
return;
NSK_DISPLAY0("Delete thread reference\n");
! NSK_TRACE(jni->DeleteGlobalRef(testedThread));
}
NSK_DISPLAY0("Let debugee to finish\n");
// SP7.1-n - notify agent end
if (!nsk_jvmti_resumeSync())
*** 178,189 ****
/* add specific capabilities for suspending thread */
{
jvmtiCapabilities suspendCaps;
memset(&suspendCaps, 0, sizeof(suspendCaps));
suspendCaps.can_suspend = 1;
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps)))
return JNI_ERR;
}
/* register agent proc and arg */
if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL)))
--- 174,184 ----
/* add specific capabilities for suspending thread */
{
jvmtiCapabilities suspendCaps;
memset(&suspendCaps, 0, sizeof(suspendCaps));
suspendCaps.can_suspend = 1;
! if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps)))
return JNI_ERR;
}
/* register agent proc and arg */
if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL)))
< prev index next >