summaryrefslogtreecommitdiff
path: root/libjava/jni.cc
diff options
context:
space:
mode:
authorbothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4>2001-05-22 06:47:48 +0000
committerbothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4>2001-05-22 06:47:48 +0000
commit98cf095aceed6a89d0524b8cfbcb11a5ee823c70 (patch)
treeecfc0fb5d915f5f6596ef061114d1b6b7ec5270a /libjava/jni.cc
parent4737d8efd8bdfccb3d0d41413aaf3933f25780ce (diff)
downloadgcc-98cf095aceed6a89d0524b8cfbcb11a5ee823c70.tar.gz
Implement invocation interface; don't create new thread for main.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42428 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/jni.cc')
-rw-r--r--libjava/jni.cc29
1 files changed, 6 insertions, 23 deletions
diff --git a/libjava/jni.cc b/libjava/jni.cc
index 3f5703a18e0..625d239c5bc 100644
--- a/libjava/jni.cc
+++ b/libjava/jni.cc
@@ -40,12 +40,13 @@ details. */
#include <java/util/Hashtable.h>
#include <java/lang/Integer.h>
#include <java/lang/ThreadGroup.h>
-#include <gnu/gcj/jni/NativeThread.h>
+#include <java/lang/Thread.h>
#include <gcj/method.h>
#include <gcj/field.h>
#include <java-interp.h>
+#include <java-threads.h>
// FIXME: remove these defines.
#define ClassClass java::lang::Class::class$
@@ -53,7 +54,6 @@ details. */
#define ThrowableClass java::lang::Throwable::class$
#define MethodClass java::lang::reflect::Method::class$
#define ThreadGroupClass java::lang::ThreadGroup::class$
-#define NativeThreadClass gnu::gcj::jni::NativeThread::class$
// This enum is used to select different template instantiations in
// the invocation code.
@@ -1862,7 +1862,7 @@ _Jv_JNI_AttachCurrentThread (JavaVM *, jstring name, void **penv, void *args)
{
try
{
- (void) new gnu::gcj::jni::NativeThread (group, name);
+ _Jv_AttachCurrentThread (name, group);
}
catch (jthrowable t)
{
@@ -1916,28 +1916,11 @@ _Jv_JNI_DestroyJavaVM (JavaVM *vm)
return JNI_ERR;
}
-static jint
+jint
_Jv_JNI_DetachCurrentThread (JavaVM *)
{
- java::lang::Thread *t = _Jv_ThreadCurrent ();
- if (t == NULL)
- return JNI_EDETACHED;
-
- // FIXME: we only allow threads attached via AttachCurrentThread to
- // be detached. I have no idea how we could implement detaching
- // other threads, given the requirement that we must release all the
- // monitors. That just seems evil.
- JvAssert ((&NativeThreadClass)->isInstance (t));
-
- // FIXME: release the monitors. We'll take this to mean all
- // monitors acquired via the JNI interface. This means we have to
- // keep track of them.
-
- gnu::gcj::jni::NativeThread *nt
- = reinterpret_cast<gnu::gcj::jni::NativeThread *> (t);
- nt->finish ();
-
- return 0;
+ jint code = _Jv_DetachCurrentThread ();
+ return code ? JNI_EDETACHED : 0;
}
static jint