On Thu, 15 Jun 2000, Jiang Wu wrote:

> Your patch is a good start.  There may be a few issues not addressed by this
> patch:
> 
> 1. Java_tcl_lang_Interp_create() may need a separate C mutex to prevent more
> than one thread from creating the JVM when used in the threaded version of
> Tcl.  I don't think know the effect of trying to call JavaSetupJava() from
> more than one thread at the same time.

That really depends on whether or not JAVA_LOCK is going to do anything.
In the call to create(), we would use the java monitor after the first 
interp is loaded into Java.

jlong JNICALL
Java_tcl_lang_Interp_create(
    JNIEnv *env,                /* Java environment. */
    jobject interpObj)          /* Handle to Interp object. */
{
    jlong lvalue;
    Tcl_Interp *interp;
    JNIEnv *oldEnv;
    int loadedFromJava = (currentEnv == NULL); /* true if Tcl Blend was 
loaded into Java */

    if (! loadedFromJava) {
        PUSH_JAVA_ENV();
    }

JavaSetupJava() just does this:

    if (initialized) {
        return TCL_OK;
    }

To be really safe, we would need to put another lock
around the code that sets up the env and
sets the initialized variable in JavaSetupJava().

Of course, that brings up the nasty case where Tcl is
compiled without thread support and yet multiple Java
threads could create an interp. I am really starting
to think Tcl Blend should just require Tcl threads
and be done with it.

> 2. Bugs in the Notifier class are not addressed.  "update" or "vwait"
> command will cause infinite loop.  Events are not removed properly from the
> event list.  "vwait" can deadlock due to synchronization.

Yeah, we still need to get those fixed. I just want to get the loading
problems out of the way first.

Mo DeJong
Red Hat Inc

----------------------------------------------------------------
The TclJava mailing list is sponsored by Scriptics Corporation.
To subscribe:    send mail to [EMAIL PROTECTED]  
                 with the word SUBSCRIBE as the subject.
To unsubscribe:  send mail to [EMAIL PROTECTED] 
                 with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'. 
An archive is available at http://www.mail-archive.com/tcljava@scriptics.com

Reply via email to