Threading / Queue management

Steve Holden steve at
Mon Feb 2 22:18:22 CET 2009

Power Button wrote:
> hi there,
> I wonder if anyone can help with the following. I have written a
> script which polls a server and if it finds and pending orders, it
> instantiates an new object (foo) - in a new thread and processes some
> data. In the new object (foo), there are also some long running
> processes so I am trying to create a thread pool/queue and to push
> items onto the queue in the instantiated object (foo). Currently I am
> creating the Queue in foo but this means I am starting up 5 new
> threads every time I instantiate foo. What I want to be able to do is
> create the Queue and start 5 (n) threads when my program starts and
> then push items onto the queue in foo.
> My question is, how can I create the Queue in my main object and set
> the target function for the Thread Constructor to be a function in
> foo?
This might help.

If not, Google around for "Python threadpool". If that doesn't help
either, come back to the list.

Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC    

More information about the Python-list mailing list