I have my own thread that needs to be called in Java. To do this, I need to bind the thread to the VM using AttachCurrentThread . Since this callback will occur quite frequently, the thread should probably remain attached. Invoking AttachCurrentThread several times is ok ("Attempting to attach a thread that is already connected is a non-statement.")
Should I call DetachCurrentThread before the thread exits, will it happen automatically or is it not even required? What happens if I call my resignation, but right? Is it just a leak, or can it damage the state of the virtual machine?
I checked the Java Native Interface specification, but either skipped this or not really specified.
My question relates specifically to Sun JDK 6 on Windows XP.
java multithreading windows jvm jni
Ronald blaschke
source share