in reply to catching Thread Exits - how ?

Your program logic is wrong, or at least very weird. The only place where you try to remove elements from your @t array is in SafeExit, and there you remove the wrong elements. You use the global $count variable to remove the elements, but $count never gets reset to 0 so you will basically remove a random element from @t, or at least not a joined element. I recommend using a hash keyed by the thread id over using some array.

Also, looking at the Thread documentation, it clearly recommends the ->eval method over the ->join method if you want to prevent dieing.

Replies are listed 'Best First'.
Re^2: catching Thread Exits - how ?
by opensourcer (Monk) on Jan 08, 2007 at 11:04 UTC
    bugs in my program, i guess i found what needs to be done.