attachCurrentThread
context(autofreeScope: AutofreeScope)
fun JavaVM.attachCurrentThread(version: JniVersion, name: CValuesRef<ByteVar>? = null, group: JObject? = null): JniEnv(source)
fun JavaVM.attachCurrentThread(version: JniVersion, name: CValuesRef<ByteVar>? = null, group: JObject? = null): JniEnv(source)
Attaches the current thread to a Java VM. Returns a JniEnv.
Trying to attach a thread that is already attached is a no-op.
A native thread cannot be attached simultaneously to two Java VMs.
When a thread is attached to the VM, the context class loader is the bootstrap loader.
Parameters
version
the requested JNI version.
name
the name of the thread in the null-terminated modified UTF-8. Use String.modifiedUtf8 to get it, or if you are sure that your string doesn't have illegal characters you may use optimized kotlinx.cinterop.utf8.
group
global ref of a ThreadGroup object.
context(autofreeScope: AutofreeScope)
inline fun JavaVM.attachCurrentThread(version: JniVersion, name: String, group: JObject? = null): JniEnv(source)
inline fun JavaVM.attachCurrentThread(version: JniVersion, name: String, group: JObject? = null): JniEnv(source)
Alias for JavaVM.attachCurrentThread which accepts the thread name as a Kotlin String.