Skip to content

Instantly share code, notes, and snippets.

@georgexsh
Created May 6, 2020 08:55
Show Gist options
  • Save georgexsh/d2989c29c949bcc85f6596ccbd8aec2d to your computer and use it in GitHub Desktop.
Save georgexsh/d2989c29c949bcc85f6596ccbd8aec2d to your computer and use it in GitHub Desktop.
queue_dead_lock.py
import os
import Queue
import threading
def f(q):
while True:
try:
q.get(block=False)
except Queue.Empty:
continue
q = Queue.Queue(2)
w = threading.Thread(target=f, args=(q,))
w.daemon = True
w.start()
if os.fork() == 0:
r = q.put(1, timeout=1)
else:
r = os.wait()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment