http://www.perlmonks.org?node_id=1020847


in reply to Re^2: Perl 5.8.8 threads, clean exit
in thread Perl 5.8.8 threads, clean exit

The best suggestion I can come up with given a) your need to stay with 5.8.8; and b) the still scant information of what the threads are doing; is:

  1. discard all the signaling stuff; it isn't doing you any good anyway.
  2. detach the threads as you create them.
  3. Have your main thread sleep for the timeout period and then just fall off the end of the script.

    When the main thread ends; all the others will end also.

    foreach $lpar ( @lparList ) { threads->create( sub { threads->yield(); manageLPAR ($action,$lpar); } )->detach; } sleep $timeout; ## fall of the end of the script ## the detach threads will end when the main thread does.

    I rarely advocate abandoning threads this way; but since even if the signals 'worked', you would have no possibility for cleanup as you could never know what your code was doing when the signal to exit arrived; it makes no difference in this case.


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.