高水準の API インデックス
*************************

このページには、すべての高水準の 非同期/待機 可能な asyncio API が一覧
になっています。


Task
====

ユーティリティは asyncio プログラムを実行し、タスクを作成し、タイムア
ウトのある複数の機能を待っています。

+----------------------------------------------------+----------------------------------------------------+
| "run()"                                            | イベントループを作成し、コルーチンを実行し、ループ |
|                                                    | を閉じます。                                       |
+----------------------------------------------------+----------------------------------------------------+
| "create_task()"                                    | asyncio タスクを開始します。                       |
+----------------------------------------------------+----------------------------------------------------+
| "await" "sleep()"                                  | 数秒間スリープします。                             |
+----------------------------------------------------+----------------------------------------------------+
| "await" "gather()"                                 | 並行してスケジュールして、待ちます。               |
+----------------------------------------------------+----------------------------------------------------+
| "await" "wait_for()"                               | タイムアウトで実行します。                         |
+----------------------------------------------------+----------------------------------------------------+
| "await" "shield()"                                 | 取り消しから保護します。                           |
+----------------------------------------------------+----------------------------------------------------+
| "await" "wait()"                                   | 完了かどうかを監視します。                         |
+----------------------------------------------------+----------------------------------------------------+
| "current_task()"                                   | 現在のタスクを返します。                           |
+----------------------------------------------------+----------------------------------------------------+
| "all_tasks()"                                      | イベントループのすべてのタスクを返します。         |
+----------------------------------------------------+----------------------------------------------------+
| "Task"                                             | Task オブジェクト                                  |
+----------------------------------------------------+----------------------------------------------------+
| "run_coroutine_threadsafe()"                       | Schedule a coroutine from another OS thread.       |
+----------------------------------------------------+----------------------------------------------------+
| "for in" "as_completed()"                          | Monitor for completion with a "for" loop.          |
+----------------------------------------------------+----------------------------------------------------+

-[ 使用例 ]-

* Using asyncio.gather() to run things in parallel.

* Using asyncio.wait_for() to enforce a timeout.

* Cancellation.

* Using asyncio.sleep().

* See also the main Tasks documentation page.


キュー
======

Queues should be used to distribute work amongst multiple asyncio
Tasks, implement connection pools, and pub/sub patterns.

+----------------------------------------------------+----------------------------------------------------+
| "Queue"                                            | A FIFO queue.                                      |
+----------------------------------------------------+----------------------------------------------------+
| "PriorityQueue"                                    | A priority queue.                                  |
+----------------------------------------------------+----------------------------------------------------+
| "LifoQueue"                                        | A LIFO queue.                                      |
+----------------------------------------------------+----------------------------------------------------+

-[ 使用例 ]-

* Using asyncio.Queue to distribute workload between several Tasks.

* See also the Queues documentation page.


サブプロセス
============

Utilities to spawn subprocesses and run shell commands.

+----------------------------------------------------+----------------------------------------------------+
| "await" "create_subprocess_exec()"                 | サブプロセスを作成します。                         |
+----------------------------------------------------+----------------------------------------------------+
| "await" "create_subprocess_shell()"                | Run a shell command.                               |
+----------------------------------------------------+----------------------------------------------------+

-[ 使用例 ]-

* Executing a shell command.

* See also the subprocess APIs documentation.


ストリーム
==========

High-level APIs to work with network IO.

+----------------------------------------------------+----------------------------------------------------+
| "await" "open_connection()"                        | Establish a TCP connection.                        |
+----------------------------------------------------+----------------------------------------------------+
| "await" "open_unix_connection()"                   | Establish a Unix socket connection.                |
+----------------------------------------------------+----------------------------------------------------+
| "await" "start_server()"                           | Start a TCP server.                                |
+----------------------------------------------------+----------------------------------------------------+
| "await" "start_unix_server()"                      | Unix のソケットサーバーを起動します。              |
+----------------------------------------------------+----------------------------------------------------+
| "StreamReader"                                     | High-level async/await object to receive network   |
|                                                    | data.                                              |
+----------------------------------------------------+----------------------------------------------------+
| "StreamWriter"                                     | High-level async/await object to send network      |
|                                                    | data.                                              |
+----------------------------------------------------+----------------------------------------------------+

-[ 使用例 ]-

* Example TCP client.

* See also the streams APIs documentation.


Synchronization
===============

Threading-like synchronization primitives that can be used in Tasks.

+----------------------------------------------------+----------------------------------------------------+
| "Lock"                                             | A mutex lock.                                      |
+----------------------------------------------------+----------------------------------------------------+
| "Event"                                            | An event object.                                   |
+----------------------------------------------------+----------------------------------------------------+
| "Condition"                                        | A condition object.                                |
+----------------------------------------------------+----------------------------------------------------+
| "Semaphore"                                        | A semaphore.                                       |
+----------------------------------------------------+----------------------------------------------------+
| "BoundedSemaphore"                                 | A bounded semaphore.                               |
+----------------------------------------------------+----------------------------------------------------+

-[ 使用例 ]-

* Using asyncio.Event.

* See also the documentation of asyncio synchronization primitives.


例外
====

+----------------------------------------------------+----------------------------------------------------+
| "asyncio.TimeoutError"                             | Raised on timeout by functions like "wait_for()".  |
|                                                    | Keep in mind that "asyncio.TimeoutError" is        |
|                                                    | **unrelated** to the built-in "TimeoutError"       |
|                                                    | exception.                                         |
+----------------------------------------------------+----------------------------------------------------+
| "asyncio.CancelledError"                           | Raised when a Task is cancelled. See also          |
|                                                    | "Task.cancel()".                                   |
+----------------------------------------------------+----------------------------------------------------+

-[ 使用例 ]-

* Handling CancelledError to run code on cancellation request.

* See also the full list of asyncio-specific exceptions.
