• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using Java threads in JNI  RSS feed

 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some JNI C++ code that gets called from a C application. Sometimes, the thread on which it gets called is not known to the JVM.

To enable the use of JNI calls into the JVM from this thread, I call AttachCurrentThreadAsDaemon().

As we attach as daemon, the attaching of this thread does not affect JVM shut-down. However, I have been unable to find out information about what other effects it has.

The main question for me is whether it is really necessary to detach my threads from the JVM explicitly. Or will the JVM automatically clean up any resources it has associated with my threads, when they die?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!