Update documentation to reflect changes to Queue.py by Tim Peters.

This commit is contained in:
Guido van Rossum 1999-02-08 18:43:13 +00:00
parent 9e1721fa79
commit ce67f06491
1 changed files with 29 additions and 15 deletions

View File

@ -25,10 +25,15 @@ zero, the queue size is infinite.
\end{classdesc} \end{classdesc}
\begin{excdesc}{Empty} \begin{excdesc}{Empty}
Exception raised when non-blocking get (e.g. \method{get_nowait()}) is Exception raised when non-blocking \method{get()} (or
called on a \class{Queue} object which is empty, or for which the \method{get_nowait()}) is called on a \class{Queue} object which is
emptyiness cannot be determined (i.e. because the appropriate locks empty or locked.
cannot be acquired). \end{excdesc}
\begin{excdesc}{Full}
Exception raised when non-blocking \method{put()} (or
\method{get_nowait()}) is called on a \class{Queue} object which is
full or locked.
\end{excdesc} \end{excdesc}
\subsection{Queue Objects} \subsection{Queue Objects}
@ -41,31 +46,40 @@ is not described here. See the source code for details. The public
methods are: methods are:
\begin{methoddesc}{qsize}{} \begin{methoddesc}{qsize}{}
Returns the approximate size of the queue. Because of multithreading Return the approximate size of the queue. Because of multithreading
semantics, this number is not reliable. semantics, this number is not reliable.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}{empty}{} \begin{methoddesc}{empty}{}
Returns \code{1} if the queue is empty, \code{0} otherwise. Because Return \code{1} if the queue is empty, \code{0} otherwise. Because
of multithreading semantics, this is not reliable. of multithreading semantics, this is not reliable.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}{full}{} \begin{methoddesc}{full}{}
Returns \code{1} if the queue is full, \code{0} otherwise. Because of Return \code{1} if the queue is full, \code{0} otherwise. Because of
multithreading semantics, this is not reliable. multithreading semantics, this is not reliable.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}{put}{item} \begin{methoddesc}{put}{item\optional{, block}}
Puts \var{item} into the queue. Put \var{item} into the queue. If optional argument \var{block} is 1
(the default), block if necessary until a free slot is available.
Otherwise (\var{block} is 0), put \var{item} on the queue if a free
slot is immediately available, else raise the \exception{Full}
exception.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}{get}{} \begin{methoddesc}{put_nowait}{item}
Gets and returns an item from the queue, blocking if necessary until Equivalent to \code{put(\var{item}, 0)}.
one is available. \end{methoddesc}
\begin{methoddesc}{get}{\optional{block}}
Remove and return an item from the queue. If optional argument
\var{block} is 1 (the default), block if necessary until an item is
available. Otherwise (\var{block} is 0), return an item if one is
immediately available, else raise the
\exception{Empty} exception.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}{get_nowait}{} \begin{methoddesc}{get_nowait}{}
Gets and returns an item from the queue if one is immediately Equivalent to \code{get(0)}.
available. Raises an \exception{Empty} exception if the queue is
empty or if the queue's emptiness cannot be determined.
\end{methoddesc} \end{methoddesc}