in reply to Re^4: killing threads inside forks
in thread killing threads inside forks
Signals won't interrupt a kernel wait state. join() is a kernel wait state.
my $index=0; foreach my $thread (@threads) #wait for all threads until the end +and insert results to hash { $hash_results{$index}=$thread->join; $index++; } return %hash_results;
Signals and threads do not mix well anywhere.
If you would describe in words, what you want to happen to the child process and its threads when your parent process decides it is time for that something to happen -- without describing the process by which the parent notifies the child, or how the child receives the notification -- then there is probably a good mechanism for doing it, that does not require sticking a spanner in the spokes to get the wheels to stop turning.
Ie:
- Do you just want the entire child process to 'go away' silently?
- Do you want the child threads to 'go away' silently, but the child's main thread to continue to run?
- Do you want the child threads to perform some final processing (perhaps returning some data to the main thread) before terminating, and then the child's main thread to do some final processing before terminating?
Until you tell us what you want to do, rather than repeating over and over how you think you ought to do it -- which clearly doesn't work; and probably never will -- there is little we can do beyond keep telling you that what you are trying to do doesn't work.
Which you already know because that's why you came here.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: killing threads inside forks
by mojo2405 (Acolyte) on Aug 01, 2013 at 13:59 UTC | |
by BrowserUk (Patriarch) on Aug 02, 2013 at 04:18 UTC | |
by mojo2405 (Acolyte) on Aug 22, 2013 at 14:50 UTC |