CNI namespace
Paul Fisher
pnfisher@redhat.com
Tue Apr 4 10:32:00 GMT 2000
Cedric Berger <cedric@wireless-networks.com> writes:
> You cannot store JNIEnv in an object, because this pointer is
> different for each thread. So if two threads access the same object,
> CRASH.
The object, or rather more of a proxy object, is created when the
foreign VM calls a JNI function. The proxy object exists until the
JNI function returns, which is always in the context of a single
thread. So each JNI invocation creates a new proxy object for `this',
along with any other proxy objects that become necessary as execution
continues.
> When I deal with native functions and JNI, I define a function that
> looks like:
That could be used as an alternative to storing each JNIEnv as thread
local data, but we need something that will work with 1.1 VMs.
More information about the Java
mailing list