in reply to END block not excuting when thread interrupted
to your program up at the top, everything exits fine on SIGINT, and the end block is executed:sub sigint { die "Dying."; } $SIG{INT} = \&sigint;
You probably want to do something other than die(), but same idea. SIGCHLD (ignored by default) will catch child deaths, if that's what you wanted originally.$ perl test.pl processing sleep(0) in thread 1 processing sleep(1) in thread 1 processing sleep(3) in thread 3 processing sleep(0) in thread 4 processing sleep(2) in thread 4 processing sleep(4) in thread 2 processing sleep(0) in thread 1 processing sleep(3) in thread 1 processing sleep(4) in thread 4 processing sleep(5) in thread 3 <C-c> Dying. at test.pl line 25. END block executed A thread exited while 3 threads were running.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: END block not excuting when thread interrupted
by iankorf (Acolyte) on Jul 10, 2006 at 01:19 UTC |