Skip to content

Instantly share code, notes, and snippets.

@kindlyfire
Created December 3, 2015 06:08
Show Gist options
  • Save kindlyfire/0f8e9f0f5827fd7b4597 to your computer and use it in GitHub Desktop.
Save kindlyfire/0f8e9f0f5827fd7b4597 to your computer and use it in GitHub Desktop.
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