This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Re: CNI namespace
Paul Fisher wrote:
> Cedric Berger <cedric@wireless-networks.com> writes:
>
> > class NativeQueue {
> > native void send(Packet p);
> > native Packet receive();
> > }
>
> [...]
>
> > will there be more than one wrapper around Packet?
>
> Each call to "send" or "receive" would result in a different proxy
> object being created. So yes, there could be two different threads
> both dealing on the same object, but there would be a different proxy
> object for each thread that was off in native-land -- in effect, more
> than one wrapper around Packet would exist at the same time, each with
> a different JNIEnv.
>
> If this doesn't answer your question, let me know.
Ok, but then how will look the CNI functions if you want to store
Packet on a global native variable (or a queue, or whatever),
for example:
Packet *_global_variable;
NativeQueue::send(Packet *p) {
_global_variable = p;
}
Packet *NativeQueue::receive() {
return _global_variable;
}
since Packet is a wrapper-class, this won't work, right?
Cedric
begin:vcard
n:Berger;Cedric
tel;fax:++1 (650) 574-4476
tel;work:++1 (650) 574-4472
x-mozilla-html:TRUE
org:Wireless Networks Inc
version:2.1
email;internet:cedric@wireless-networks.com
title:Embedded Software Engineer
adr;quoted-printable:;;2322 El Camino Real=0D=0A;San Mateo;CA;94403;USA
fn:Cedric Berger
end:vcard