< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadEnd/threadend002/threadend002.cpp

Print this page
rev 52185 : 8212148: Remove remaining NSK_CPP_STUBs
Summary: Remove remaining macros
Reviewed-by: amenkov, phh


  40 
  41 /* ============================================================================= */
  42 
  43 JNIEXPORT void JNICALL
  44 cbThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni_env, jthread thread) {
  45 
  46     eventCount++;
  47 }
  48 
  49 /* ============================================================================= */
  50 
  51 static int
  52 enableEvent(jvmtiEventMode enable, jvmtiEvent event) {
  53 
  54     if (enable == JVMTI_ENABLE) {
  55         NSK_DISPLAY1("enabling %s\n", TranslateEvent(event));
  56     } else {
  57         NSK_DISPLAY1("disabling %s\n", TranslateEvent(event));
  58     }
  59 
  60     if (!NSK_JVMTI_VERIFY(
  61             NSK_CPP_STUB4(SetEventNotificationMode, jvmti, enable,
  62                                             event, NULL))) {
  63         nsk_jvmti_setFailStatus();
  64         return NSK_FALSE;
  65     }
  66 
  67     return NSK_TRUE;
  68 }
  69 
  70 /* ============================================================================= */
  71 
  72 int checkEvents() {
  73 
  74     int result = NSK_TRUE;
  75 
  76     if (eventCount == 0) {
  77         nsk_jvmti_setFailStatus();
  78         NSK_COMPLAIN0("Number of THREAD_END events must be greater than 0\n");
  79         nsk_jvmti_setFailStatus();
  80         result = NSK_FALSE;
  81     }
  82 
  83     return result;
  84 }
  85 
  86 /* ============================================================================= */
  87 
  88 static int
  89 setCallBacks() {
  90     jvmtiEventCallbacks eventCallbacks;
  91     memset(&eventCallbacks, 0, sizeof(eventCallbacks));
  92 
  93     eventCallbacks.ThreadEnd = cbThreadEnd;
  94 
  95     if (!NSK_JVMTI_VERIFY(
  96             NSK_CPP_STUB3(SetEventCallbacks, jvmti,
  97                                 &eventCallbacks,
  98                                 sizeof(eventCallbacks))))
  99         return NSK_FALSE;
 100 
 101     return NSK_TRUE;
 102 }
 103 
 104 /* ============================================================================= */
 105 
 106 /** Agent algorithm. */
 107 static void JNICALL
 108 agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) {
 109 
 110     NSK_DISPLAY0("Wait for debuggee to become ready\n");
 111     if (!nsk_jvmti_waitForSync(timeout))
 112         return;
 113 
 114     NSK_DISPLAY0("Let debuggee to continue\n");
 115     if (!nsk_jvmti_resumeSync())
 116         return;
 117 
 118     if (!nsk_jvmti_waitForSync(timeout))




  40 
  41 /* ============================================================================= */
  42 
  43 JNIEXPORT void JNICALL
  44 cbThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni_env, jthread thread) {
  45 
  46     eventCount++;
  47 }
  48 
  49 /* ============================================================================= */
  50 
  51 static int
  52 enableEvent(jvmtiEventMode enable, jvmtiEvent event) {
  53 
  54     if (enable == JVMTI_ENABLE) {
  55         NSK_DISPLAY1("enabling %s\n", TranslateEvent(event));
  56     } else {
  57         NSK_DISPLAY1("disabling %s\n", TranslateEvent(event));
  58     }
  59 
  60     if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, NULL))) {


  61         nsk_jvmti_setFailStatus();
  62         return NSK_FALSE;
  63     }
  64 
  65     return NSK_TRUE;
  66 }
  67 
  68 /* ============================================================================= */
  69 
  70 int checkEvents() {
  71 
  72     int result = NSK_TRUE;
  73 
  74     if (eventCount == 0) {
  75         nsk_jvmti_setFailStatus();
  76         NSK_COMPLAIN0("Number of THREAD_END events must be greater than 0\n");
  77         nsk_jvmti_setFailStatus();
  78         result = NSK_FALSE;
  79     }
  80 
  81     return result;
  82 }
  83 
  84 /* ============================================================================= */
  85 
  86 static int
  87 setCallBacks() {
  88     jvmtiEventCallbacks eventCallbacks;
  89     memset(&eventCallbacks, 0, sizeof(eventCallbacks));
  90 
  91     eventCallbacks.ThreadEnd = cbThreadEnd;
  92 
  93     if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))



  94         return NSK_FALSE;
  95 
  96     return NSK_TRUE;
  97 }
  98 
  99 /* ============================================================================= */
 100 
 101 /** Agent algorithm. */
 102 static void JNICALL
 103 agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) {
 104 
 105     NSK_DISPLAY0("Wait for debuggee to become ready\n");
 106     if (!nsk_jvmti_waitForSync(timeout))
 107         return;
 108 
 109     NSK_DISPLAY0("Let debuggee to continue\n");
 110     if (!nsk_jvmti_resumeSync())
 111         return;
 112 
 113     if (!nsk_jvmti_waitForSync(timeout))


< prev index next >