Because of multithreading semantics, this is not reliable.

OlafMeding at gmail.com OlafMeding at gmail.com
Wed May 3 16:09:09 EDT 2006


Because of multithreading semantics, this is not reliable.  This
sentence is found in the Python documentation for "7.8.1 Queue
Objects".

This scares me!  Why would Queue.qsize(), Queue.empty( ), and a
Queue.full() not be reliable?

Looking at the source code of Queue.py, all 3 calls use a mutex (based
on thread.allocate_lock()).  Does this mean that the
thread.allocate_lock() mechanism is not reliable (scary indeed) or does
this have to do with other implementation details?

Many thanks for explaining this mystery.

Olaf




More information about the Python-list mailing list