[Python-Dev] collections module

Josiah Carlson jcarlson at uci.edu
Fri Jan 9 17:02:55 EST 2004


> below is quite fast for most reasonable numbers of threads - it does
> wake all threads up that were waiting, but I find it considerably clearer,
> and can be done with a single synchronization primitive.

Oh, by adding a second Condition(), you don't need to notify everyone
and can replace the 'while' uses with 'if'.  Even faster.

One thing that bothered me about using the three mutexes as given in
Queue.Queue is that it relies on the fact that a thread can unlock an
underlying thread.lock that it didn't acquire.  To me, this is strange
behavior.

 - Josiah



More information about the Python-Dev mailing list