Multiprocessing problem

Matt Chaput matt at whoosh.ca
Wed Mar 3 00:04:09 CET 2010


On 3/2/2010 3:59 PM, Matt Chaput wrote:
 > I'm trying to use a simple pattern where a supervisor object starts a
 > bunch of worker processes, instantiating them with two queues (a job
 > queue for tasks to complete and an results queue for the results). The
 > supervisor puts all the jobs in the "job" queue, then join()s the
 > workers, and then pulls all the completed results off the "results" 
queue.

 > Here's a simplified example:
 >
 > http://pastie.org/850512

I should mention that if I change my code so the workers just pull 
things off the job queue but don't put any results on the result queue 
until after they see the None sentinel in the job queue and break out of 
the loop, I don't get the deadlock. So it's something about getting from 
one queue and putting to another queue in close proximity.

Hopefully I'm making a simple mistake with how I'm using the library and 
it'll be easy to fix...

Thanks,

Matt



More information about the Python-list mailing list