Michal Chruszcz wrote:
... First idea, which came to my mind, was using a queue. I've got many
producers (all of the workers) and one consumer. Seams quite simple,
but it isn't, at least for me. I presumed that each worker will put()
its results to the queue, and finally will close() it, while the
parent process will get() them as long as there is an active
subprocess....

Well, if the protocol for a worker is:
    <someloop>:
         <calculate>
         queue.put(result)
    queue.put(<worker_end_sentinel>)
    queue.close()


Then you can keep count of how many have finished in the consumer.

--Scott David Daniels
scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to