Multithreaded class with queues

Antal Rutz arutz at mimoza.pantel.net
Fri Jul 22 06:12:41 EDT 2005


Hi!

I wrote a little class to make multihreading easier. It's based on one
of aahz's threading example scripts. What it does:

It spawns up number of CollectorThreads and one ProcessThread. The
CollectorThreads listen on one queue (inputqueue), read, process the
data (with colfunc), put the result onto the outputqueue. The
ProcessThread listens on the outputqueue, reads, processes (with
prfunc). end. (more details in the attached file)

it seems to work with test functions but when I use a network-intensive
function (snmp-queries) it just gets slower with maxThreads set to more
than 1.

Any help?
Thanks.
see the class attached.
ps. Maybe I basically don't understand something...

-- 


--arutz
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: C.py
URL: <http://mail.python.org/pipermail/python-list/attachments/20050722/6b434d45/attachment.ksh>


More information about the Python-list mailing list