blob: 62de445336eb164bcc2995082ea9bf9983bfdbb2 [file] [log] [blame]
Guido van Rossum7a465642013-11-22 11:47:22 -08001:mod:`asyncio` -- Asynchronous I/O, event loop, coroutines and tasks
2====================================================================
3
4.. module:: asyncio
5 :synopsis: Asynchronous I/O, event loop, coroutines and tasks.
6
7.. versionadded:: 3.4
8
Guido van Rossumf8d0ff92013-11-22 16:53:25 -08009**Source code:** :source:`Lib/asyncio/`
10
11--------------
Guido van Rossum7a465642013-11-22 11:47:22 -080012
Antoine Pitroubba86822013-11-23 00:34:26 +010013This module provides infrastructure for writing single-threaded concurrent
14code using coroutines, multiplexing I/O access over sockets and other
15resources, running network clients and servers, and other related primitives.
Guido van Rossum7a465642013-11-22 11:47:22 -080016
Antoine Pitroubba86822013-11-23 00:34:26 +010017Here is a more detailed list of the package contents:
18
19* a pluggable :ref:`event loop <event-loop>` with various system-specific
20 implementations;
21
22* :ref:`transport <transport>` and :ref:`protocol <protocol>` abstractions
23 (similar to those in `Twisted <http://twistedmatrix.com/>`_);
24
25* concrete support for TCP, UDP, SSL, subprocess pipes, delayed calls, and
26 others (some may be system-dependent);
27
28* a Future class that mimicks the one in the :mod:`concurrent.futures` module,
29 but adapted for use with the event loop;
30
31* coroutines and tasks based on ``yield from`` (:PEP:`380`), to help write
32 concurrent code in a sequential fashion;
33
34* cancellation support for Futures and coroutines;
35
36* :ref:`synchronization primitives <sync>` for use between coroutines in
37 a single thread, mimicking those in the :mod:`threading` module;
38
Guido van Rossumf0f5d382013-11-22 15:45:02 -080039* an interface for passing work off to a threadpool, for times when
40 you absolutely, positively have to use a library that makes blocking
41 I/O calls.
42
Antoine Pitroubba86822013-11-23 00:34:26 +010043
44Disclaimer
Victor Stinnerfa2ce782013-12-03 00:56:27 +010045==========
Guido van Rossum7a465642013-11-22 11:47:22 -080046
47Full documentation is not yet ready; we hope to have it written
48before Python 3.4 leaves beta. Until then, the best reference is
49:PEP:`3156`. For a motivational primer on transports and protocols,
50see :PEP:`3153`.
Antoine Pitroubba86822013-11-23 00:34:26 +010051
Victor Stinnerea3183f2013-12-03 01:08:00 +010052.. toctree::
53 :maxdepth: 3
54 :numbered:
Antoine Pitroubba86822013-11-23 00:34:26 +010055
Victor Stinnerea3183f2013-12-03 01:08:00 +010056 asyncio-eventloop.rst
57 asyncio-task.rst
58 asyncio-protocol.rst
59 asyncio-sync.rst
Antoine Pitroubba86822013-11-23 00:34:26 +010060