Mercurial > cpython-lru_cache-weakref
comparison Doc/lib/libqueue.tex @ 25796:3eafbde56b21 legacy-trunk
Patch #572628: Optional timeouts for put and get.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Tue, 15 Oct 2002 15:11:13 +0000 |
| parents | 1f6510051c8a |
| children | 63fa60f2d61c |
comparison
equal
deleted
inserted
replaced
| 25795:ac14317a9ae8 | 25796:3eafbde56b21 |
|---|---|
| 52 Return the approximate size of the queue. Because of multithreading | 52 Return the approximate size of the queue. Because of multithreading |
| 53 semantics, this number is not reliable. | 53 semantics, this number is not reliable. |
| 54 \end{methoddesc} | 54 \end{methoddesc} |
| 55 | 55 |
| 56 \begin{methoddesc}{empty}{} | 56 \begin{methoddesc}{empty}{} |
| 57 Return \code{1} if the queue is empty, \code{0} otherwise. Because | 57 Return \code{True} if the queue is empty, \code{False} otherwise. |
| 58 of multithreading semantics, this is not reliable. | 58 Becauseof multithreading semantics, this is not reliable. |
| 59 \end{methoddesc} | 59 \end{methoddesc} |
| 60 | 60 |
| 61 \begin{methoddesc}{full}{} | 61 \begin{methoddesc}{full}{} |
| 62 Return \code{1} if the queue is full, \code{0} otherwise. Because of | 62 Return \code{True} if the queue is full, \code{False} otherwise. |
| 63 multithreading semantics, this is not reliable. | 63 Because of multithreading semantics, this is not reliable. |
| 64 \end{methoddesc} | 64 \end{methoddesc} |
| 65 | 65 |
| 66 \begin{methoddesc}{put}{item\optional{, block}} | 66 \begin{methoddesc}{put}{item\optional{, block\optional{, timeout}}} |
| 67 Put \var{item} into the queue. If optional argument \var{block} is 1 | 67 Put \var{item} into the queue. If optional args \var{block} is true |
| 68 (the default), block if necessary until a free slot is available. | 68 and \var{timeout} is None (the default), block if necessary until a |
| 69 Otherwise (\var{block} is 0), put \var{item} on the queue if a free | 69 free slot is available. If \var{timeout} is a positive number, it |
| 70 blocks at most \var{timeout} seconds and raises the \exception{Full} | |
| 71 exception if no free slot was available within that time. | |
| 72 Otherwise (\var{block} is false), put an item on the queue if a free | |
| 70 slot is immediately available, else raise the \exception{Full} | 73 slot is immediately available, else raise the \exception{Full} |
| 71 exception. | 74 exception (\var{timeout} is ignored in that case). |
| 75 | |
| 76 \versionadded[the timeout parameter]{2.3} | |
| 77 | |
| 72 \end{methoddesc} | 78 \end{methoddesc} |
| 73 | 79 |
| 74 \begin{methoddesc}{put_nowait}{item} | 80 \begin{methoddesc}{put_nowait}{item} |
| 75 Equivalent to \code{put(\var{item}, 0)}. | 81 Equivalent to \code{put(\var{item}, False)}. |
| 76 \end{methoddesc} | 82 \end{methoddesc} |
| 77 | 83 |
| 78 \begin{methoddesc}{get}{\optional{block}} | 84 \begin{methoddesc}{get}{\optional{block\optional{, timeout}}} |
| 79 Remove and return an item from the queue. If optional argument | 85 Remove and return an item from the queue. If optional args |
| 80 \var{block} is 1 (the default), block if necessary until an item is | 86 \var{block} is true and \var{timeout} is None (the default), |
| 81 available. Otherwise (\var{block} is 0), return an item if one is | 87 block if necessary until an item is available. If \var{timeout} is |
| 82 immediately available, else raise the | 88 a positive number, it blocks at most \var{timeout} seconds and raises |
| 83 \exception{Empty} exception. | 89 the \exception{Empty} exception if no item was available within that |
| 90 time. Otherwise (\var{block} is false), return an item if one is | |
| 91 immediately available, else raise the \exception{Empty} exception | |
| 92 (\var{timeout} is ignored in that case). | |
| 93 | |
| 94 \versionadded[the timeout parameter]{2.3} | |
| 95 | |
| 84 \end{methoddesc} | 96 \end{methoddesc} |
| 85 | 97 |
| 86 \begin{methoddesc}{get_nowait}{} | 98 \begin{methoddesc}{get_nowait}{} |
| 87 Equivalent to \code{get(0)}. | 99 Equivalent to \code{get(False)}. |
| 88 \end{methoddesc} | 100 \end{methoddesc} |
