Created
December 11, 2015 19:40
-
-
Save rectalogic/bd4820a4cf0e93cca801 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
import signal | |
import Queue | |
def handler(signum, frame): | |
global shutdown | |
# Don't log here, not reentrant | |
shutdown = True | |
signal.signal(signal.SIGTERM, handler) | |
signal.signal(signal.SIGINT, handler) | |
q = Queue.Queue() | |
while True: | |
try: | |
q.get(timeout=100000) | |
except Queue.Empty: | |
print "Empty" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment