This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: invocation interface
- To: Jeff Sturm <jsturm at one-point dot com>
- Subject: Re: invocation interface
- From: Cedric Berger <cedric at wireless-networks dot com>
- Date: Wed, 16 May 2001 09:15:33 -0700
- CC: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>, java at gcc dot gnu dot org
- References: <Pine.LNX.4.10.10105161155460.24370-100000@mars.deadcafe.org>
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