<html><body>
<p><tt>Gustaf Neumann <neumann@wu-wien.ac.at> wrote on 08/16/2006 03:06:18 AM:<br>
<br>
> Scott Gargash schrieb:<br>
> ><br>
> > So I inserted my own exitHandler and that works in a single thread, <br>
> > but when I have multiple threads, things get confused. <br>
> ><br>
> You have not told us, what "confused" means (other than: "i get an <br>
> error") since your<br>
> example works for me.<br>
</tt><br>
<tt>Sorry, I omitted that. My example gives the following error:</tt><br>
<br>
<tt>Error from thread tid00000C20</tt><br>
<tt>invalid command name "tclPkgUnknown"</tt><br>
<tt> while executing</tt><br>
<tt>"tclPkgUnknown XOTcl {}"</tt><br>
<tt> ("package unknown" script)</tt><br>
<tt> invoked from within</tt><br>
<tt>"package require XOTcl"</tt><br>
<tt>User defined exit handler contains errors!</tt><br>
<tt>Error in line 2: target thread died</tt><br>
<tt>Execution interrupted.</tt><br>
<br>
<br>
<tt>My actual code doesn't give any consistent behavior. Sometimes it sort of works, sometimes it generates corrupt data, and sometimes it dumps core.</tt><br>
<tt><br>
> If you have multiple threads, and you want to control the order, in <br>
> which the threads exit<br>
> (and in which their exit handlers are called), you have to do this on <br>
> your own<br>
> as well (not using "exit", but your own shutdown command). Be aware of,<br>
> that tcl tries to shutdown your threads on exit as well.<br>
</tt><br>
<br>
<tt>A ha, you've describe my problem (and also the solution I found). I have exit handlers in all the threads, and I get inconsistent behavior. I wound up overriding exit to get things to exit in a defined manner.</tt><br>
<br>
<tt>It was in the process of trying to reduce it down to a simple test case that I found the problem (described above) on WinXP with just a single exit handler. Now, perhaps that's an real problem of some sort also, but it sounds like I need to continue overriding "exit" to get the desired behavior in the real codebase.</tt><br>
<br>
<tt>        Scott</tt><br>
<br>
<tt> <br>
</tt></body></html>