[Twisted-Python] PATCH: setattr problem in ThreadAttr

Itamar Shtull-Trauring twisted at itamarst.org
Thu Nov 14 00:16:45 MST 2002


On Thu, 14 Nov 2002 07:02:21 +0100
"Matthias Urlichs" <smurf at noris.de> wrote:

> Yes -- the source data are coming from a database (and the consumer
> may have to do database look-ups too). Since the consumer can be
> slower and I don't want in-core memory to grow indiscriminately, some
> sort of thread-safe bounded queuing makes sense.

Just use Queue.Queue then?

> Unrelated nit: twisted.python.timeoutqueue lacks a pop() function with
> timeout (the wait+pop combo is NOT thread safe: you might have
> multiple consumers), and, frankly, the basic idea of timeout-waiting
> on a queue the way this module does it is just plain ugly.

It sucks, yes. I needed it though and couldn't think up a better way of
doing it.

> I'd have to reinvent all of Queue's thread-support features, though.
> That might be a nice exercise, but I'll spend my time on required
> features first.  ;-)

I have code that does this. But if you want bounded size you may as well
stick to Queue, I sped it up by removing support for this :)


-- 
Itamar Shtull-Trauring    http://itamarst.org/
Available for Python, Twisted, Zope and Java consulting
***> http://VoteNoWar.org -- vote/donate/volunteer <***




More information about the Twisted-Python mailing list