Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re^3: Force 2 'ctrl-c's to kill program

by jethro (Monsignor)
on Feb 11, 2013 at 18:13 UTC ( #1018207=note: print w/replies, xml ) Need Help??

in reply to Re^2: Force 2 'ctrl-c's to kill program
in thread Force 2 'ctrl-c's to kill program

So you didn't eliminate the sleep() call? Think about it, why would you still need the sleep call when you know the time the first ctrl-c happened. Without the sleep call the ctrl-c subroutine should be finished almost immediately.

PS: Using something like sleep() in an interrupt routine is bad design. Interrupt routines should never have a long running time because the code they are interrupting might have expectations of things occuring at a certain speed without seconds-long freezing. For example the user interface

  • Comment on Re^3: Force 2 'ctrl-c's to kill program

Replies are listed 'Best First'.
Re^4: Force 2 'ctrl-c's to kill program
by Anonymous Monk on Feb 12, 2013 at 09:40 UTC
    I understand what you were originally proposing now (along the lines of BrowserUK's code below I assume). Thanks for the advice on sleep. I definitely should take more core in using it.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018207]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2018-01-18 21:53 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (215 votes). Check out past polls.