< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.c

Print this page

        

*** 60,69 **** --- 60,81 ---- #define STATUS_FAILED 2 #define TRIES 30 #define MAX_THREADS 5 + // Helper for thread detach and terminate + #define THREAD_return(status) \ + do { \ + int res = JNI_ENV_PTR(vm)->DetachCurrentThread(JNI_ENV_ARG1(vm)); \ + if (res != 0) \ + NSK_COMPLAIN1("TEST WARNING: DetachCurrentThread() returns: %d\n", res); \ + else \ + NSK_DISPLAY0("Detaching thread ...\n"); \ + return status; \ + } while (0) + + static const char *javaField = "_ji06t001a"; static const char *classSig = "Lnsk/jvmti/scenarios/jni_interception/JI06/ji06t001a;"; static JavaVM *vm;
*** 223,242 **** indx); thrStarted[indx-1] = 1; /* the thread is started */ if (enterMonitor(env, "waitingThread") == STATUS_FAILED) ! return STATUS_FAILED; if (verbose) printf("waitingThread: thread #%d entered the monitor\n", indx); if (exitMonitor(env, "waitingThread") == STATUS_FAILED) ! return STATUS_FAILED; NSK_DISPLAY2("waitingThread: thread #%d exits the monitor\n\treturning %d\n", indx, exitCode); ! return exitCode; } static int ownerThread(void *context) { JNIEnv *env; int exitCode = PASSED; --- 235,254 ---- indx); thrStarted[indx-1] = 1; /* the thread is started */ if (enterMonitor(env, "waitingThread") == STATUS_FAILED) ! THREAD_return(STATUS_FAILED); if (verbose) printf("waitingThread: thread #%d entered the monitor\n", indx); if (exitMonitor(env, "waitingThread") == STATUS_FAILED) ! THREAD_return(STATUS_FAILED); NSK_DISPLAY2("waitingThread: thread #%d exits the monitor\n\treturning %d\n", indx, exitCode); ! THREAD_return(exitCode); } static int ownerThread(void *context) { JNIEnv *env; int exitCode = PASSED;
*** 252,262 **** return STATUS_FAILED; } NSK_DISPLAY0("ownerThread: trying to enter the monitor ...\n"); if (enterMonitor(env, "ownerThread") == STATUS_FAILED) ! return STATUS_FAILED; monEntered = 1; /* the monitor has been entered */ NSK_DISPLAY1("ownerThread: entered the monitor: monEntered=%d\n\ \twaiting ...\n", monEntered); --- 264,274 ---- return STATUS_FAILED; } NSK_DISPLAY0("ownerThread: trying to enter the monitor ...\n"); if (enterMonitor(env, "ownerThread") == STATUS_FAILED) ! THREAD_return(STATUS_FAILED); monEntered = 1; /* the monitor has been entered */ NSK_DISPLAY1("ownerThread: entered the monitor: monEntered=%d\n\ \twaiting ...\n", monEntered);
*** 270,285 **** "ownerThread: time exceed")); } } while(releaseMon != 1); if (exitMonitor(env, "ownerThread") == STATUS_FAILED) ! return STATUS_FAILED; NSK_DISPLAY1("ownerThread: exits the monitor\n\treturning %d\n", exitCode); ! return exitCode; } static int redirectorThread(void *context) { JNIEnv *env; int exitCode = PASSED; --- 282,297 ---- "ownerThread: time exceed")); } } while(releaseMon != 1); if (exitMonitor(env, "ownerThread") == STATUS_FAILED) ! THREAD_return(STATUS_FAILED); NSK_DISPLAY1("ownerThread: exits the monitor\n\treturning %d\n", exitCode); ! THREAD_return(exitCode); } static int redirectorThread(void *context) { JNIEnv *env; int exitCode = PASSED;
*** 299,309 **** doRedirect(env); NSK_DISPLAY1("redirectorThread: the MonitorEnter() redirected\n\treturning %d\n", exitCode); ! return exitCode; } /*********************/ static jobject getObjectFromField(JNIEnv *env, jobject obj) { jfieldID fid; --- 311,321 ---- doRedirect(env); NSK_DISPLAY1("redirectorThread: the MonitorEnter() redirected\n\treturning %d\n", exitCode); ! THREAD_return(exitCode); } /*********************/ static jobject getObjectFromField(JNIEnv *env, jobject obj) { jfieldID fid;
< prev index next >