[Python-checkins] cpython (3.4): asyncio, Tulip issue 220: Update doc of asyncio.Queue, add join and task_done

victor.stinner python-checkins at python.org
Tue Feb 17 23:14:58 CET 2015


https://hg.python.org/cpython/rev/6beaf66f0410
changeset:   94668:6beaf66f0410
branch:      3.4
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Feb 17 23:09:52 2015 +0100
summary:
  asyncio, Tulip issue 220: Update doc of asyncio.Queue, add join and task_done
methods

files:
  Doc/library/asyncio-sync.rst |  98 ++++++++++++-----------
  1 files changed, 53 insertions(+), 45 deletions(-)


diff --git a/Doc/library/asyncio-sync.rst b/Doc/library/asyncio-sync.rst
--- a/Doc/library/asyncio-sync.rst
+++ b/Doc/library/asyncio-sync.rst
@@ -310,6 +310,9 @@
    be interrupted between calling :meth:`qsize` and doing an operation on the
    Queue.
 
+   .. versionchanged:: 3.4.3
+      New :meth:`join` and :meth:`task_done` methods.
+
    .. method:: empty()
 
       Return ``True`` if the queue is empty, ``False`` otherwise.
@@ -341,6 +344,20 @@
       Return an item if one is immediately available, else raise
       :exc:`QueueEmpty`.
 
+   .. coroutinemethod:: join()
+
+      Block until all items in the queue have been gotten and processed.
+
+      The count of unfinished tasks goes up whenever an item is added to the
+      queue. The count goes down whenever a consumer thread calls
+      :meth:`task_done` to indicate that the item was retrieved and all work on
+      it is complete.  When the count of unfinished tasks drops to zero,
+      :meth:`join` unblocks.
+
+      This method is a :ref:`coroutine <coroutine>`.
+
+      .. versionadded:: 3.4.3
+
    .. coroutinemethod:: put(item)
 
       Put an item into the queue. If the queue is full, wait until a free slot
@@ -362,51 +379,6 @@
 
       Number of items in the queue.
 
-   .. attribute:: maxsize
-
-      Number of items allowed in the queue.
-
-
-PriorityQueue
-^^^^^^^^^^^^^
-
-.. class:: PriorityQueue
-
-   A subclass of :class:`Queue`; retrieves entries in priority order (lowest
-   first).
-
-   Entries are typically tuples of the form: (priority number, data).
-
-
-LifoQueue
-^^^^^^^^^
-
-.. class:: LifoQueue
-
-    A subclass of :class:`Queue` that retrieves most recently added entries
-    first.
-
-
-JoinableQueue
-^^^^^^^^^^^^^
-
-.. class:: JoinableQueue
-
-   A subclass of :class:`Queue` with :meth:`task_done` and :meth:`join`
-   methods.
-
-   .. coroutinemethod:: join()
-
-      Block until all items in the queue have been gotten and processed.
-
-      The count of unfinished tasks goes up whenever an item is added to the
-      queue. The count goes down whenever a consumer thread calls
-      :meth:`task_done` to indicate that the item was retrieved and all work on
-      it is complete.  When the count of unfinished tasks drops to zero,
-      :meth:`join` unblocks.
-
-      This method is a :ref:`coroutine <coroutine>`.
-
    .. method:: task_done()
 
       Indicate that a formerly enqueued task is complete.
@@ -422,6 +394,42 @@
       Raises :exc:`ValueError` if called more times than there were items
       placed in the queue.
 
+      .. versionadded:: 3.4.3
+
+   .. attribute:: maxsize
+
+      Number of items allowed in the queue.
+
+
+PriorityQueue
+^^^^^^^^^^^^^
+
+.. class:: PriorityQueue
+
+   A subclass of :class:`Queue`; retrieves entries in priority order (lowest
+   first).
+
+   Entries are typically tuples of the form: (priority number, data).
+
+
+LifoQueue
+^^^^^^^^^
+
+.. class:: LifoQueue
+
+    A subclass of :class:`Queue` that retrieves most recently added entries
+    first.
+
+
+JoinableQueue
+^^^^^^^^^^^^^
+
+.. class:: JoinableQueue
+
+   Deprecated alias for :class:`Queue`.
+
+   .. deprecated:: 3.4.3
+
 
 Exceptions
 ^^^^^^^^^^

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list