|laziness, impatience, and hubris|
Force 2 'ctrl-c's to kill programby albob (Sexton)
|on Feb 11, 2013 at 17:11 UTC||Need Help??|
albob has asked for the
wisdom of the Perl Monks concerning the following question:
I would like to force a user to have to hit ctrl-c twice within 2 seconds in order to kill my program (safety net to prevent unintentional killing of the program). Ideally my code would look like the following:
However this obviously does not work (or I would not be hee :)). It looks like the first entry to "control_c_observed" must fully complete before the 2nd interupt request will be serviced.
Does anyone know of a way of achieving my desired behavior?