invocation interface

Cedric Berger cedric@wireless-networks.com
Wed May 16 09:14:00 GMT 2001


Jeff Sturm wrote:

> On Wed, 16 May 2001, Cedric Berger wrote:
> > > 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?
>
> I'm looking at
>
> http://java.sun.com/j2se/1.3/docs/guide/jni/spec/invocation.doc.html#16089
>
> "Only the main thread can unload the VM. The main thread must be the
> only remaining user thread when it calls DestroyJavaVM()."

Yep, the JNI documentation from Sun is in a terrible shape.
For Java 2 (1.2 or 1.3), they basically just put the old 1.1 documentation,
without updating it, with an additional file describing changes in 1.2:

http://java.sun.com/j2se/1.3/docs/guide/jni/jni-12.html

It's a shame.
The new DestroyVM section is here:

http://java.sun.com/j2se/1.3/docs/guide/jni/jni-12.html#DestroyJavaVM


> > 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.
>
> Hmm... that sounds more like our _Jv_ThreadWait.  I wasn't aware that Sun
> changed this part of the spec.
>
> Jeff



More information about the Java mailing list