Skip to content

Latest commit

 

History

History
158 lines (94 loc) · 4.18 KB

asyncio-queue.rst

File metadata and controls

158 lines (94 loc) · 4.18 KB
.. currentmodule:: asyncio

Queues

Queues:

asyncio queue API was designed to be close to classes of the :mod:`queue` module (:class:`~queue.Queue`, :class:`~queue.PriorityQueue`, :class:`~queue.LifoQueue`), but it has no timeout parameter. The :func:`asyncio.wait_for` function can be used to cancel a task after a timeout.

Queue

PriorityQueue

A subclass of :class:`Queue`; retrieves entries in priority order (lowest first).

Entries are typically tuples of the form: (priority number, data).

LifoQueue

A subclass of :class:`Queue` that retrieves most recently added entries first.

Exceptions

.. exception:: QueueEmpty

   Exception raised when the :meth:`~Queue.get_nowait` method is called on a
   :class:`Queue` object which is empty.


.. exception:: QueueFull

   Exception raised when the :meth:`~Queue.put_nowait` method is called on a
   :class:`Queue` object which is full.