Better (?) text describing the lack of guarantees provided by qsize(),

empty() and full().
This commit is contained in:
Skip Montanaro 2008-01-15 03:40:20 +00:00
parent d4c2e8659c
commit f233b0c454
1 changed files with 11 additions and 6 deletions

View File

@ -49,20 +49,25 @@ See the source code for details. The public methods are:
.. method:: Queue.qsize() .. method:: Queue.qsize()
Return the approximate size of the queue. Because of multithreading semantics, Return the approximate size of the queue. qsize() > 0 doesn't guarantee
this number is not reliable. that a subsequent get() will not block, nor that qsize() < maxsize
guarantee that put() will not block.
.. method:: Queue.empty() .. method:: Queue.empty()
Return ``True`` if the queue is empty, ``False`` otherwise. Because of Return ``True`` if the queue is empty, ``False`` otherwise. If empty()
multithreading semantics, this is not reliable. returns ``True`` it doesn't guarantee that a subsequent call to put()
will not block. Similarly, if empty() returns ``False`` it doesn't
guarantee that a subsequent call to get() will not block.
.. method:: Queue.full() .. method:: Queue.full()
Return ``True`` if the queue is full, ``False`` otherwise. Because of Return ``True`` if the queue is full, ``False`` otherwise. If full()
multithreading semantics, this is not reliable. returns ``True`` it doesn't guarantee that a subsequent call to get()
will not block. Similarly, if full() returns ``False`` it doesn't
guarantee that a subsequent call to put() will not block.
.. method:: Queue.put(item[, block[, timeout]]) .. method:: Queue.put(item[, block[, timeout]])