From 82d2be8e718d141f70a56d3686de9b9dabf9ead3 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Tue, 3 Nov 2009 14:52:14 -0700 Subject: [PATCH] implement JavaVM::AttachCurrentThreadAsDaemon --- src/jnienv.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/jnienv.cpp b/src/jnienv.cpp index 6a31950abd..391938180a 100644 --- a/src/jnienv.cpp +++ b/src/jnienv.cpp @@ -41,6 +41,19 @@ AttachCurrentThread(Machine* m, Thread** t, void*) return 0; } +jint JNICALL +AttachCurrentThreadAsDaemon(Machine* m, Thread** t, void* parameters) +{ + *t = static_cast(m->localThread->get()); + if (*t == 0) { + AttachCurrentThread(m, t, parameters); + + ENTER(*t, Thread::ActiveState); + setDaemon(*t, (*t)->javaThread, true); + } + return 0; +} + jint JNICALL DetachCurrentThread(Machine* m) { @@ -1902,6 +1915,7 @@ populateJNITables(JavaVMVTable* vmTable, JNIEnvVTable* envTable) vmTable->DestroyJavaVM = DestroyJavaVM; vmTable->AttachCurrentThread = AttachCurrentThread; + vmTable->AttachCurrentThreadAsDaemon = AttachCurrentThreadAsDaemon; vmTable->DetachCurrentThread = DetachCurrentThread; vmTable->GetEnv = GetEnv;