Hi Mo,

I have a suggestion: put this at the top of thetcl.lang.Interp.eval() code:
     if (!(Thread.currentThread().getName().equals("main"))) {
         throw new TclException(
             "tcl.lang.Interp.eval() cannot be called from any Java thread 
other than main."
             + "Please see 
http://www-cs-students.stanford.edu/~jwu/Using_Tcl_in_Java.html"
         );
     }
(or whatever web reference you think will be around and stable --
probably should be at scriptics.com)

That way, people will find out about the shortcoming directly, rather
than having to dig into their code and figure it out for themselves.

Thanks,
  - Mike

 > Date: Tue, 25 Jul 2000 12:23:55 -0700 (PDT)
 > From: Mo DeJong <[EMAIL PROTECTED]>
 > To: Mike Schwartz <[EMAIL PROTECTED]>
 > cc: [EMAIL PROTECTED]
 > Subject: Re: [Tcl Java] problem invoking tclBlend calls from within Java 
threads
 >
 >
 > On Tue, 25 Jul 2000, Mike Schwartz wrote:
 >
 >
 > > Hi,
 > >
 > > I've come across another problem with tclBlend.
 > ...
 > > Synopsis: if you start up a Java program from Tcl and that Java program
 > > creates multiple threads that try to invoke tcl.lang.Interp.eval() (with
 > > appropriate synchronization so they are not interspersing commands with
 > > each other), the threads hang waiting for the eval call to complete.
 >
 >
 >
 > We really need to embed a .wav file in tcljava.jar that plays
 > "You can't do that dave" when someone tries to call Interp.eval()
 > from another thread. If you try this, things wil get really hosed
 > (as you found out).
 >
 >
 > Here are some posts that cover how to do it correctly.
 >
 >
 > http://www.mail-archive.com/tcljava@scriptics.com/msg00647.html
 >
 >
 > http://www.mail-archive.com/tcljava@scriptics.com/msg00604.html
 >
 >
 > http://www.mail-archive.com/tcljava@scriptics.com/msg00619.html
 >
 >
 > Jiang also wrote up a nice overview of the situation, you
 > can find his paper here:
 >
 >
 > http://www-cs-students.stanford.edu/~jwu/Using_Tcl_in_Java.html
 >
 >
 > Getting all of this shared knowledge back into the documentation
 > is on the TODO list. We also need some nice small examples that
 > people can look at without having to read all the API docs.
 >
 >
 > 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