|Perl Monk, Perl Meditation|
Re^7: killing threads inside forksby BrowserUk (Pope)
|on Aug 02, 2013 at 04:18 UTC||Need Help??|
Caution: I cannot test this because I don't have a real fork. But ... there are several problems with your code.
So, when you say:
this code actually works good when sending USR1 signal
You are wrong. It doesn't "work", it simply breaks your main thread out of the sleep loop. Nothing else.
The signals you think you are sending your threads are never arriving, because you don;t set up their signal handlers until just before they finish. But even if you correct that; those signals still won;t kill the threads -- because kill signals are ignored -- and if you send some other signal, they threads still won't see it until they've finished whatever they are doing.
Which might or might not ever happen; I've no way to tell because you keep posting dummy snippets instead of real code; and have still failed to describe what these threads are actually doing.
I said it earlier, and I'll say it again: signals and threads do not mix.
(The threads-signals stuff should never have been added to the api it is essentially useless!)
If you ever post the real code; and a proper description of what your code is actually doing; I might try to help you further; but for now ....
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.