classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GTK peer switching JNIEnv *?


From: Archie Cobbs
Subject: Re: GTK peer switching JNIEnv *?
Date: Fri, 14 Jan 2005 09:23:27 -0600
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041129

Robert Lougher wrote:
So to be compliant I've got to use a separate JNIEnv for each thread,
but there's no point putting anything in it, because it'll break with
the gtk code :)

No, I don't think the VM has to use different JNIEnv * pointers
for different threads. But it may. The point is that the onus is on
the native code to use the one provided by the VM consistently
with that same thread, no matter what the VM does. The VM is the
"master" and the native code is the "slave" in other words.

For example, the VM could have a single JNIEnv * pointer, and then
use pthread_getspecific() at each crossing into/out of native code
to determine which thread it's actually dealing with.

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]