Created
December 11, 2015 19:57
-
-
Save rectalogic/f987b02624c40da06c2b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import signal | |
import Queue | |
def handler(signum, frame): | |
q.put(None) | |
signal.signal(signal.SIGTERM, handler) | |
signal.signal(signal.SIGINT, handler) | |
q = Queue.Queue() | |
while True: | |
try: | |
v = q.get(timeout=100000) | |
if v is None: | |
print "Got None" | |
break | |
except Queue.Empty: | |
print "Empty" | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment