albob has asked for the wisdom of the Perl Monks concerning the following question:
my $prev_ctrlc = 0; $SIG{'INT'} = \&control_c_observed; sub control_c_observed { if ($prev_ctrlc ==0) { print "Second ctrl-c within 2 seconds required\n"; $prev_ctrlc = 1; sleep (2); $prev_ctrlc = 0; } else { print "This was the 2nd!Dying.\n"; exit; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Force 2 'ctrl-c's to kill program
by BrowserUk (Patriarch) on Feb 11, 2013 at 17:22 UTC | |
by albob (Sexton) on Feb 11, 2013 at 17:34 UTC | |
by BrowserUk (Patriarch) on Feb 11, 2013 at 18:13 UTC | |
by Anonymous Monk on Feb 12, 2013 at 09:41 UTC | |
|
Re: Force 2 'ctrl-c's to kill program
by jethro (Monsignor) on Feb 11, 2013 at 17:18 UTC | |
by albob (Sexton) on Feb 11, 2013 at 17:23 UTC | |
by jethro (Monsignor) on Feb 11, 2013 at 18:13 UTC | |
by Anonymous Monk on Feb 12, 2013 at 09:40 UTC | |
|
Re: Force 2 'ctrl-c's to kill program
by ww (Archbishop) on Feb 11, 2013 at 17:44 UTC | |
by Anonymous Monk on Feb 12, 2013 at 09:45 UTC |