http://qs321.pair.com?node_id=549835

JFarr has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks, I have an app that users tend to Ctrl-C out of once they get the data they need...which they should not do :(. I'm using the "use Threads:shared" Is there a way to check for existing thrads that may be alive after a user kills the script then starts it again? I would like to harvest the threads at the launch/re-launch of the script but have not found anything that looks like it can do this. Thanks in advance

Replies are listed 'Best First'.
Re: stray threads
by zentara (Archbishop) on May 16, 2006 at 18:22 UTC
    When a parent thread is killed, all child threads will die with it, with the warning "a thread exited while some were running". If a child thread does an "exit", it will take all others with them. Threads are tricky that way.

    So I don't think you can do what you want, or you are not stating the question correctly, or are misunderstanding the situation.

    You may need to disable Control-c, or have a routine that intercepts that signal, and saves the state of the other threads.


    I'm not really a human, but I play one on earth. flash japh