Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

stray threads

by JFarr (Sexton)
on May 16, 2006 at 17:59 UTC ( #549835=perlquestion: print w/replies, xml ) Need Help??

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

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://549835]
Approved by samizdat
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2023-05-31 00:49 GMT
Find Nodes?
    Voting Booth?

    No recent polls found