Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: Handling abnormal thread terminationby zentara (Archbishop) |
on Mar 29, 2014 at 17:51 UTC ( [id://1080221]=note: print w/replies, xml ) | Need Help?? |
Just as a general design idea, how about a combination of putting some code at the end of the thread code block, to indicate it is done, with a timeout on each thread. To catch all the malfuctioning threads, launch each thread with a sister timer thread. When a preset timeout is hit, the main thread kills() the hung thread; or when the thread finishes properly, it is all cleaned up. You may be better off using an event-loop system for launching the threads, and avoid the sister thread, by using eventloop timers.
I'm not really a human, but I play one on earth. Old Perl Programmer Haiku ................... flash japh
In Section
Seekers of Perl Wisdom
|
|