Currently, TclBlend has a deadlock problem when the Java Garbage Collector
running as an independent GC thread tries to finalize a TclObject that wraps
around a C Tcl_Obj.  The main reason is that the Tcl_Obj in Tcl is not meant
to be thread safe.  A Tcl_Obj can only be free'ed by the same thread that
created it.

Mo has proposed a solution, in which we track the thread that created
TclObject wrapper on Tcl_Obj.  Then, when the Java GC thread finalizes the
TclObject, the internal Tcl_Obj is queued to a "free list".  At a later
point, the thread that created TclObject would be used to free the Tcl_Obj
on the "free list".

I see a potential problem with this approach when the thread does not use
the Tcl event queue.  For example,

    Interp interp = new Interp();
    TclObject result = interp.getVar("x");

In this process, a TclObject with a Tcl_Obj is created.  The thread
continues on doing other work without using the event queue of 'interp'.
How do we get this thread to free objects on the "free list"?

-- Jiang Wu
   [EMAIL PROTECTED]



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