>>>>> Jason Dillon writes:

    Jason> This is not really java-linux specific, but this is the
    Jason> only java related group that I am subscribed to.  I am
    Jason> wondering if a native method is specified as synchronized
    Jason> if the jvm will perform the proper MontiorEnter &
    Jason> MonitorExit calls or if I should call them in the native
    Jason> method.

    Jason> So for example... does:

    Jason> native public synchronized byte[] getBytes ();

    Jason> imply:

    Jason> JNIEXPORT jbyteArray JNICALL Java_<Package>_<Class>_getBytes
    Jason>   (JNIEnv *env, jobject jthis)
    Jason> {
    Jason>         (*env)->MonitorEnter(env, jthis);
    Jason>         /* do something */
    Jason>         (*env)->MonitorExit(env, jthis);

    Jason>         return /* some jbyteArray */;
    Jason> }

Not exactly, the method indeed is synchronized but the synchronization
is part of the method invocation and return. Section 7.14 of the
virtual machine specification has more details about that:
http://java.sun.com/docs/books/vmspec/html/Compiling.doc.html#6530


        Juergen

-- 
Juergen Kreileder, Universitaet Dortmund, Lehrstuhl Informatik V
Baroper Strasse 301, D-44221 Dortmund, Germany
Phone: ++49 231/755-5806, Fax: ++49 231/755-5802

Reply via email to