Queue qsize = unreliable?

Aahz aahz at pythoncraft.com
Fri Aug 6 17:05:43 EDT 2004


In article <mailman.1285.1091808631.5135.python-list at python.org>,
Ames Andreas (MPA/DF) <Andreas.Ames at tenovis.com> wrote:
>
>I've got one:  If you have the special situation that there is only a
>single consumer with potentially multiple suppliers (or similarly if
>you have it the other way around), you could implement the consumer in
>a non-blocking manner.  Then it's not that important to get "the exact
>current size" which would still be unreliable but it is important to
>have a reliable empty method (or rather !empty() and full() are
>reliable in this situation).  I think Queue is reliable in this
>respect but to get it additionally non-blocking you will have to roll
>your own queue.

Try reading the Queue docs -- there IS a non-blocking Queue already.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"To me vi is Zen.  To use vi is to practice zen.  Every command is a
koan.  Profound to the user, unintelligible to the uninitiated.  You
discover truth everytime you use it."  --reddy at lion.austin.ibm.com



More information about the Python-list mailing list