attachCurrentThreadAsDaemon

context(autofreeScope: AutofreeScope)
fun JavaVM.attachCurrentThreadAsDaemon(version: JniVersion, name: CValuesRef<ByteVar>? = null, group: JObject? = null): JniEnv(source)

Same semantics as attachCurrentThread, but the newly created java.lang.Thread instance is a daemon.

If the thread has already been attached via either AttachCurrentThread or AttachCurrentThreadAsDaemon, this routine simply returns JNIEnv of the current thread. In this case neither AttachCurrentThread nor this routine have any effect on the daemon status of the thread.

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.attachCurrentThreadAsDaemon(version: JniVersion, name: String, group: JObject? = null): JniEnv(source)

Alias for JavaVM.attachCurrentThreadAsDaemon which accepts the thread name as a Kotlin String.