All pastes #835422 Raw Edit

valhallasw

public python v1 · immutable
#835422 ·published 2007-12-28 21:30 UTC
rendered paste body
q = Queue.Queue()class T (threading.Thread):  def run(self):    while(True):      print q.get()T().start()q.put('blah')how to:  (a) make the thread end when the program is done and the queue is empty?it's possible to put several None items on the queue and check for that, but that requires knowledge of the number of threads.. there probably is a better way :)