diff options
author | Georg Brandl <georg@python.org> | 2008-05-25 07:20:14 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-05-25 07:20:14 (GMT) |
commit | a6168f9e0a0ff77910e783df36f5dd4b5dfa7372 (patch) | |
tree | 5424d6e36503bda00ee3a63638737a9973b4a4fb /Doc/library | |
parent | 8107290fa186bd5efa2a9c158000fd578d228a6c (diff) | |
download | cpython-a6168f9e0a0ff77910e783df36f5dd4b5dfa7372.zip cpython-a6168f9e0a0ff77910e783df36f5dd4b5dfa7372.tar.gz cpython-a6168f9e0a0ff77910e783df36f5dd4b5dfa7372.tar.bz2 |
Queue renaming reversal part 3: move module into place and
change imports and other references. Closes #2925.
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/queue.rst | 32 | ||||
-rw-r--r-- | Doc/library/threading.rst | 2 |
2 files changed, 16 insertions, 18 deletions
diff --git a/Doc/library/queue.rst b/Doc/library/queue.rst index aafd717..6ee9702 100644 --- a/Doc/library/queue.rst +++ b/Doc/library/queue.rst @@ -2,17 +2,15 @@ =========================================== .. module:: Queue - :synopsis: Old name for the queue module. - -.. module:: queue :synopsis: A synchronized queue class. .. note:: - The :mod:`Queue` module has been renamed to :mod:`queue` in Python 3.0. It - is importable under both names in Python 2.6 and the rest of the 2.x series. + The :mod:`Queue` module has been renamed to :mod:`queue` in Python 3.0. The + :term:`2to3` tool will automatically adapt imports when converting your + sources to 3.0. -The :mod:`queue` module implements multi-producer, multi-consumer queues. +The :mod:`Queue` module implements multi-producer, multi-consumer queues. It is especially useful in threaded programming when information must be exchanged safely between multiple threads. The :class:`Queue` class in this module implements all the required locking semantics. It depends on the @@ -26,7 +24,7 @@ the first retrieved (operating like a stack). With a priority queue, the entries are kept sorted (using the :mod:`heapq` module) and the lowest valued entry is retrieved first. -The :mod:`queue` module defines the following classes and exceptions: +The :mod:`Queue` module defines the following classes and exceptions: .. class:: Queue(maxsize) @@ -75,7 +73,7 @@ Queue Objects ------------- Queue objects (:class:`Queue`, :class:`LifoQueue`, or :class:`PriorityQueue`) -provide the public methods described below. +provide the public methods described below. .. method:: Queue.qsize() @@ -170,20 +168,20 @@ fully processed by daemon consumer threads. Example of how to wait for enqueued tasks to be completed:: - def worker(): - while True: - item = q.get() - do_work(item) - q.task_done() + def worker(): + while True: + item = q.get() + do_work(item) + q.task_done() - q = Queue() - for i in range(num_worker_threads): + q = Queue() + for i in range(num_worker_threads): t = Thread(target=worker) t.setDaemon(True) - t.start() + t.start() for item in source(): - q.put(item) + q.put(item) q.join() # block until all tasks are done diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst index 7658ebb..8cb84b3 100644 --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -8,7 +8,7 @@ This module constructs higher-level threading interfaces on top of the lower level :mod:`thread` module. -See also the :mod:`mutex` and :mod:`queue` modules. +See also the :mod:`mutex` and :mod:`Queue` modules. The :mod:`dummy_threading` module is provided for situations where :mod:`threading` cannot be used because :mod:`thread` is missing. |