RFR: 8329596: Add test for virtual threads invoking synchronized native methods

David Holmes dholmes at openjdk.org
Fri Apr 5 01:14:15 UTC 2024


On Wed, 3 Apr 2024 10:52:10 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> This is a test-only addition to add a test for virtual threads invoking a synchronized native method and invoking a native method that enter/exits a monitor with JNI MonitorEnter/MonitorExit. The test has been in the loom repo for some time, it can move to the main line in advance of changes to the object monitor implementation.

test/jdk/java/lang/Thread/virtual/libSynchronizedNative.c line 29:

> 27: Java_SynchronizedNative_runWithSynchronizedNative(JNIEnv *env, jobject obj, jobject task) {
> 28:     jclass clazz = (*env)->GetObjectClass(env, obj);
> 29:     jmethodID mid = (*env)->GetMethodID(env, clazz, "run", "(Ljava/lang/Runnable;)V");

Does this generate a warning with `-Xcheck:jni` due to exceptions not being checked for?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/18600#discussion_r1552648444


More information about the core-libs-dev mailing list