Commit ec5dd52b by Tom Tromey Committed by Tom Tromey

jni.cc (_Jv_JNI_AttachCurrentThread): Return environment if it already exists.

	* jni.cc (_Jv_JNI_AttachCurrentThread): Return environment if it
	already exists.

From-SVN: r109936
parent 5bf5a10b
2006-01-18 Tom Tromey <tromey@redhat.com>
* jni.cc (_Jv_JNI_AttachCurrentThread): Return environment if it
already exists.
2006-01-18 Keith Seitz <keiths@redhat.com> 2006-01-18 Keith Seitz <keiths@redhat.com>
* include/java-interp.h (_Jv_CompileMethod): Add declaration. * include/java-interp.h (_Jv_CompileMethod): Add declaration.
......
// jni.cc - JNI implementation, including the jump table. // jni.cc - JNI implementation, including the jump table.
/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 /* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation Free Software Foundation
This file is part of libgcj. This file is part of libgcj.
...@@ -2352,10 +2352,14 @@ _Jv_JNI_AttachCurrentThread (JavaVM *, jstring name, void **penv, ...@@ -2352,10 +2352,14 @@ _Jv_JNI_AttachCurrentThread (JavaVM *, jstring name, void **penv,
} }
// Attaching an already-attached thread is a no-op. // Attaching an already-attached thread is a no-op.
if (_Jv_GetCurrentJNIEnv () != NULL) JNIEnv *env = _Jv_GetCurrentJNIEnv ();
return 0; if (env != NULL)
{
*penv = reinterpret_cast<void *> (env);
return 0;
}
JNIEnv *env = (JNIEnv *) _Jv_MallocUnchecked (sizeof (JNIEnv)); env = (JNIEnv *) _Jv_MallocUnchecked (sizeof (JNIEnv));
if (env == NULL) if (env == NULL)
return JNI_ERR; return JNI_ERR;
env->p = &_Jv_JNIFunctions; env->p = &_Jv_JNIFunctions;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment