Wed May 16 07:53:00 GMT 2001
Jeff Sturm wrote:
> Bryce McKinlay wrote:
> > By "FirstThread" I actually meant the "sentinal thread which sits in
> > _Jv_ThreadWait waiting for all other non-daemon threads to die", not the
> > gnu.gcj.FirstThread. The same behaviour could be acomplished by having each
> > thread check how many other threads are running when it exits, but I'm not
> > convinced that wouldn't make the code more complex and less portable.
> How is this done with JNI? The Sun JNI docs say DestroyJavaVM must not
> be called until all non-main threads have terminated.
Where did you get that?
Here is the relevent part of the doc:
jint DestroyJavaVM(JavaVM *vm)
The support for DestroyJavaVM was not complete in 1.1. Only the main thread may call DestroyJavaVM. In the Java 2 SDK, any thread,
whether attached or not, can call this function. If the current thread is attached, the VM waits until the current thread is the
only user-level Java thread. If the current thread is not attached, the VM attaches the current thread and then waits until the
current thread is the only user-level thread. The Java 2 SDK still does not support VM unloading, however. DestroyJavaVM always
returns an error code.
More information about the Java