From 92e69ece74d74b2339fb22ce49483229bcb117dc Mon Sep 17 00:00:00 2001 From: Landry Norris Date: Mon, 11 Jul 2022 21:50:26 -0500 Subject: [PATCH] Added docs --- .../github/landrynorris/jniutils/MonitorOperations.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/jni-utils/src/commonMain/kotlin/io/github/landrynorris/jniutils/MonitorOperations.kt b/jni-utils/src/commonMain/kotlin/io/github/landrynorris/jniutils/MonitorOperations.kt index 276d0a0..82851e6 100644 --- a/jni-utils/src/commonMain/kotlin/io/github/landrynorris/jniutils/MonitorOperations.kt +++ b/jni-utils/src/commonMain/kotlin/io/github/landrynorris/jniutils/MonitorOperations.kt @@ -5,11 +5,21 @@ import platform.android.JNIEnvVar import platform.android.JNINativeMethod import platform.android.jobject +/** + * Enter the monitor owned by obj + * + * Do not mix JNI [monitorExit] with Java synchronized method + */ fun CPointer.monitorEnter(obj: jobject) { val method = pointed.pointed?.MonitorEnter ?: error("JNI is not Oracle standard") method.invoke(this, obj) } +/** + * The current thread must be the owner of the monitor associated with obj. + * + * Do not mix JNI [monitorExit] with Java synchronized method + */ fun CPointer.monitorExit(obj: jobject) { val method = pointed.pointed?.MonitorExit ?: error("JNI is not Oracle standard") method.invoke(this, obj)