Message136724
> Is it unclear to you what those mean?
Well, it's clear, but I like when I can simply copy/paste the example and it does just work:
> If you post a high-quality self-contained example somewhere
> on the net, I would be happy to link to it.
I just propose to change the example to stop the threads:
------------------
def worker():
while True:
item = q.get()
if item is None:
break
do_work(item)
q.task_done()
q = Queue()
threads = []
for i in range(num_worker_threads):
t = Thread(target=worker)
threads.append(t)
t.start()
for item in source():
q.put(item)
q.join() # block until all tasks are done
for i in range(num_worker_threads):
q.put(None)
for t in threads: t.join()
------------------ |
|
Date |
User |
Action |
Args |
2011-05-24 07:32:37 | vstinner | set | recipients:
+ vstinner, rhettinger, pitrou, docs@python |
2011-05-24 07:32:37 | vstinner | set | messageid: <1306222357.13.0.382806629523.issue12155@psf.upfronthosting.co.za> |
2011-05-24 07:32:36 | vstinner | link | issue12155 messages |
2011-05-24 07:32:36 | vstinner | create | |
|