Created
December 3, 2015 06:08
-
-
Save kindlyfire/0f8e9f0f5827fd7b4597 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with GracefulInterruptHandler() as h1: | |
while True: | |
print "(1)..." | |
time.sleep(1) | |
with GracefulInterruptHandler() as h2: | |
while True: | |
print "\t(2)..." | |
time.sleep(1) | |
if h2.interrupted: | |
print "\t(2) interrupted!" | |
time.sleep(2) | |
break | |
if h1.interrupted: | |
print "(1) interrupted!" | |
time.sleep(2) | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment