from threading import Thread from Queue import Queue import string def do_work(item): print(item) def worker(q): while True: item = q.get() do_work(item) q.task_done() if __name__ == u"__main__": queue = Queue() # start thread pool for _ in xrange(10): thread = Thread(target=worker, args=(queue,)) # This works as expected on Jython and CPython # thread.setDaemon(True) # This only works as expected on CPython. On # Jython it gets past the `queue.join()` line, # then hangs thread.daemon = True thread.start() for letter in string.letters: queue.put(letter) queue.join()