Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2005

Tip: Looking for answers? Try searching our database.

Jini and global reference

Thread view: 
Elpitzote - 28 Oct 2005 08:50 GMT
I tried to use a Jni global reference in C code but it works well on
the same Thread with multiple calls of the native function, but it
doesn't works across different Threads.
How can i share a global variable between Threads?
Any suggestion is appreciated.  
Thanks.

Lorenzo Viti
Chris Uppal - 28 Oct 2005 11:50 GMT
> I tried to use a Jni global reference in C code but it works well on
> the same Thread with multiple calls of the native function, but it
> doesn't works across different Threads.

That /should/ work -- it's one of the things that global refs are /for/.  I
suspect that you may be attempting to use the wrong JNIEnv.  Each thread that
is allowed to use JNI at all has at least one JNIEnv (depending on how deeply
nested callbacks between Java and JNI are), and you always have to use the
correct one. If that guess isn't correct, then you'll have to say more about
how/what you are doing with your threads and references.

   -- chris


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.