Force sleep to ignore interrupts

Jeremy Sanders jeremy+complangpython at jeremysanders.net
Thu Sep 14 06:56:45 EDT 2006


andychambers2002 at yahoo.co.uk wrote:

> It works as I want when used in the main application thread.
> That is, when you hit Ctr + C, it stops running.  However, if
> the class that subclasses it, also subclasses Thread, it breaks
> in that hitting Ctrl + C interrupts the call to sleep which puts
> the event loop out of sync with real time.

Maybe you could install a signal handler to ignore ctrl+c, when required

import signal
signal.signal(signal.SIGINT, signal.SIG_IGN)


-- 
Jeremy Sanders
http://www.jeremysanders.net/



More information about the Python-list mailing list