< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd007/stopthrd007.cpp

Print this page
rev 52185 : [mq]: refactor

*** 60,71 **** int i; NSK_DISPLAY0("Prepare: find tested threads\n"); /* get all live threads */ ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads))) return NSK_FALSE; if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) return NSK_FALSE; --- 60,70 ---- int i; NSK_DISPLAY0("Prepare: find tested threads\n"); /* get all live threads */ ! if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) return NSK_FALSE;
*** 73,84 **** for (i = 0; i < threads_count; i++) { if (!NSK_VERIFY(threads[i] != NULL)) return NSK_FALSE; /* get thread information */ ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info))) return NSK_FALSE; NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ --- 72,82 ---- for (i = 0; i < threads_count; i++) { if (!NSK_VERIFY(threads[i] != NULL)) return NSK_FALSE; /* get thread information */ ! if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info))) return NSK_FALSE; NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */
*** 91,117 **** sleepingThread = threads[i]; } } } ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads))) return NSK_FALSE; NSK_DISPLAY0("Prepare: create new instance of ThreadDeath exception\n"); ! if (!NSK_JNI_VERIFY(jni, (cls = ! NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = ! NSK_CPP_STUB4(GetMethodID, jni, cls, ! THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) return NSK_FALSE; ! if (!NSK_JNI_VERIFY(jni, (threadDeath = ! NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL)) return NSK_FALSE; return NSK_TRUE; } --- 89,111 ---- sleepingThread = threads[i]; } } } ! if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; NSK_DISPLAY0("Prepare: create new instance of ThreadDeath exception\n"); ! if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = ! jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) return NSK_FALSE; ! if (!NSK_JNI_VERIFY(jni, (threadDeath = jni->NewObject(cls, ctor)) != NULL)) return NSK_FALSE; return NSK_TRUE; }
*** 131,160 **** NSK_DISPLAY0("Testcase #1: call StopThread for runningThread\n"); if (!NSK_VERIFY(runningThread != NULL)) { nsk_jvmti_setFailStatus(); } else { ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(StopThread, ! jvmti, runningThread, threadDeath))) nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("Testcase #2: call StopThread for waitingThread\n"); if (!NSK_VERIFY(waitingThread != NULL)) { nsk_jvmti_setFailStatus(); } else { ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(StopThread, ! jvmti, waitingThread, threadDeath))) nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("Testcase #3: call StopThread for sleepingThread\n"); if (!NSK_VERIFY(sleepingThread != NULL)) { nsk_jvmti_setFailStatus(); } else { ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(StopThread, ! jvmti, sleepingThread, threadDeath))) nsk_jvmti_setFailStatus(); } if (!nsk_jvmti_resumeSync()) return; --- 125,151 ---- NSK_DISPLAY0("Testcase #1: call StopThread for runningThread\n"); if (!NSK_VERIFY(runningThread != NULL)) { nsk_jvmti_setFailStatus(); } else { ! if (!NSK_JVMTI_VERIFY(jvmti->StopThread(runningThread, threadDeath))) nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("Testcase #2: call StopThread for waitingThread\n"); if (!NSK_VERIFY(waitingThread != NULL)) { nsk_jvmti_setFailStatus(); } else { ! if (!NSK_JVMTI_VERIFY(jvmti->StopThread(waitingThread, threadDeath))) nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("Testcase #3: call StopThread for sleepingThread\n"); if (!NSK_VERIFY(sleepingThread != NULL)) { nsk_jvmti_setFailStatus(); } else { ! if (!NSK_JVMTI_VERIFY(jvmti->StopThread(sleepingThread, threadDeath))) nsk_jvmti_setFailStatus(); } if (!nsk_jvmti_resumeSync()) return;
*** 192,202 **** if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); caps.can_signal_thread = 1; ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) { return JNI_ERR; } return JNI_OK; } --- 183,193 ---- if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); caps.can_signal_thread = 1; ! if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) { return JNI_ERR; } return JNI_OK; }
< prev index next >