< prev index next >

test/hotspot/jtreg/serviceability/jvmti/GetOwnedMonitorInfo/libGetOwnedMonitorInfoTest.c

Print this page
@@ -20,10 +20,11 @@
   * or visit www.oracle.com if you need additional information or have any
   * questions.
   */
  
  #include <stdio.h>
+ #include <stdlib.h>
  #include <string.h>
  #include "jvmti.h"
  #include "jni.h"
  
  #ifdef __cplusplus

@@ -262,10 +263,18 @@
      }
      printf("Agent_OnLoad finished\n");
      return JNI_OK;
  }
  
+ JNIEXPORT void JNICALL
+ Java_GetOwnedMonitorInfoTest_jniMonitorEnter(JNIEnv* env, jclass cls, jobject obj) {
+     if ((*env)->MonitorEnter(env, obj) != 0) {
+         fprintf(stderr, "MonitorEnter failed");
+         exit(-1);
+     }
+ }
+ 
  JNIEXPORT jint JNICALL
  Java_GetOwnedMonitorInfoTest_check(JNIEnv *env, jclass cls) {
      return status;
  }
  
< prev index next >