Yes, you are correct.  I noticed this after doing more research into the
notifier and event loop implementation in Tcl.

Per thread event loop can be achieve in Java easily.  But there are some
outstanding questions:

1. In UNIX, TclBlend uses a pipe with non-blocking IO to wake up the Tcl
event loop.  If there are multiple event loops in several threads, will a
single pipe based IO trigger all event loops to wake up?

2. In Windows, a Win32 native window event is used to call Tcl_ServiceAll()
to trigger the Tcl event loop.  The same question applies, does
Tcl_ServiceAll() trigger all Tcl event loops to wake up?

3. Currently, I am seeing a problem on Solaris, where the non-blocking pipe
used in TclBlend is triggering a busy loop on reading from the pipe.  The
similar code in Tcl 8.3.1 for the event loop has a slightly different
implementation from that used in TclBlend with a comment about "reading only
1 byte at a time to avoid some race condition".

Your insights into these matter are greatly appreciated.

-- Jiang Wu
   [EMAIL PROTECTED]

> From: Scott Stanton <[EMAIL PROTECTED]>
> Date: Mon, 07 Aug 2000 11:07:26 -0700
> To: Jiang Wu <[EMAIL PROTECTED]>
> Cc: Mo DeJong <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> Subject: Re: TclBlend Initialization Mutex
> 
> 
> Jiang Wu said:
>> I added a global mutex to protect TclBlend initialization from mutiple
>> threads.  The patch is sent to Mo for check in.  This mutex together
> with
>> Mo's changes on removing the global lock and making JNIEnv thread local
> make
>> TclBlend almost thread safe.  I say "almost" because we still need to
> make
>> one last change to the Java side of TclBlend to make the Notifier class
> per
>> Interp.
> 
> The Notifier really should be per-thread, not per-Interp.  There can be
> many interpreters in a single thread and they should all share the same
> notifier.  I don't know if there's a easy way to get this effect in Java.
> 
> --Scott
> 
> 

----------------------------------------------------------------
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