-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathasyncio.html
More file actions
368 lines (348 loc) · 28.5 KB
/
asyncio.html
File metadata and controls
368 lines (348 loc) · 28.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh_TW">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>19.5. asyncio — Asynchronous I/O, event loop, coroutines and tasks — Python 3.7.0 說明文件</title>
<link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/translations.js"></script>
<script type="text/javascript" src="../_static/sidebar.js"></script>
<link rel="search" type="application/opensearchdescription+xml"
title="在 Python 3.7.0 說明文件 中搜尋"
href="../_static/opensearch.xml"/>
<link rel="author" title="關於這些文件" href="../about.html" />
<link rel="index" title="索引" href="../genindex.html" />
<link rel="search" title="搜尋" href="../search.html" />
<link rel="copyright" title="Copyright" href="../copyright.html" />
<link rel="next" title="19.5.1. Base Event Loop" href="asyncio-eventloop.html" />
<link rel="prev" title="19.4. selectors — High-level I/O multiplexing" href="selectors.html" />
<link rel="shortcut icon" type="image/png" href="../_static/py.png" />
<link rel="canonical" href="https://docs.python.org/3/library/asyncio.html" />
<script type="text/javascript" src="../_static/copybutton.js"></script>
<script type="text/javascript" src="../_static/switchers.js"></script>
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>瀏覽</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">索引</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python 模組索引"
>模組</a> |</li>
<li class="right" >
<a href="asyncio-eventloop.html" title="19.5.1. Base Event Loop"
accesskey="N">下一頁</a> |</li>
<li class="right" >
<a href="selectors.html" title="19.4. selectors — High-level I/O multiplexing"
accesskey="P">上一頁</a> |</li>
<li><img src="../_static/py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="https://www.python.org/">Python</a> »</li>
<li>
<span class="language_switcher_placeholder">zh_TW</span>
<span class="version_switcher_placeholder">3.7.0</span>
<a href="../index.html">Documentation </a> »
</li>
<li class="nav-item nav-item-1"><a href="index.html" >Python 標準函式庫 (Standard Library)</a> »</li>
<li class="nav-item nav-item-2"><a href="ipc.html" accesskey="U">19. Interprocess Communication and Networking</a> »</li>
<li class="right">
<div class="inline-search" style="display: none" role="search">
<form class="inline-search" action="../search.html" method="get">
<input placeholder="Quick search" type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('.inline-search').show(0);</script>
|
</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="module-asyncio">
<span id="asyncio-asynchronous-i-o-event-loop-coroutines-and-tasks"></span><h1>19.5. <a class="reference internal" href="#module-asyncio" title="asyncio: Asynchronous I/O, event loop, coroutines and tasks."><code class="xref py py-mod docutils literal notranslate"><span class="pre">asyncio</span></code></a> — Asynchronous I/O, event loop, coroutines and tasks<a class="headerlink" href="#module-asyncio" title="本標題的永久連結">¶</a></h1>
<div class="versionadded">
<p><span class="versionmodified">3.4 版新加入.</span></p>
</div>
<p><strong>Source code:</strong> <a class="reference external" href="https://github.com/python/cpython/tree/3.7/Lib/asyncio/">Lib/asyncio/</a></p>
<hr class="docutils" />
<p>This module provides infrastructure for writing single-threaded concurrent
code using coroutines, multiplexing I/O access over sockets and other
resources, running network clients and servers, and other related primitives.
Here is a more detailed list of the package contents:</p>
<ul class="simple">
<li>a pluggable <a class="reference internal" href="asyncio-eventloop.html#asyncio-event-loop"><span class="std std-ref">event loop</span></a> with various system-specific
implementations;</li>
<li><a class="reference internal" href="asyncio-protocol.html#asyncio-transport"><span class="std std-ref">transport</span></a> and <a class="reference internal" href="asyncio-protocol.html#asyncio-protocol"><span class="std std-ref">protocol</span></a> abstractions
(similar to those in <a class="reference external" href="https://twistedmatrix.com/trac/">Twisted</a>);</li>
<li>concrete support for TCP, UDP, SSL, subprocess pipes, delayed calls, and
others (some may be system-dependent);</li>
<li>a <a class="reference internal" href="asyncio-task.html#asyncio.Future" title="asyncio.Future"><code class="xref py py-class docutils literal notranslate"><span class="pre">Future</span></code></a> class that mimics the one in the <a class="reference internal" href="concurrent.futures.html#module-concurrent.futures" title="concurrent.futures: Execute computations concurrently using threads or processes."><code class="xref py py-mod docutils literal notranslate"><span class="pre">concurrent.futures</span></code></a>
module, but adapted for use with the event loop;</li>
<li>coroutines and tasks based on <code class="docutils literal notranslate"><span class="pre">yield</span> <span class="pre">from</span></code> (<span class="target" id="index-0"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0380"><strong>PEP 380</strong></a>), to help write
concurrent code in a sequential fashion;</li>
<li>cancellation support for <a class="reference internal" href="asyncio-task.html#asyncio.Future" title="asyncio.Future"><code class="xref py py-class docutils literal notranslate"><span class="pre">Future</span></code></a>s and coroutines;</li>
<li><a class="reference internal" href="asyncio-sync.html#asyncio-sync"><span class="std std-ref">synchronization primitives</span></a> for use between coroutines in
a single thread, mimicking those in the <a class="reference internal" href="threading.html#module-threading" title="threading: Thread-based parallelism."><code class="xref py py-mod docutils literal notranslate"><span class="pre">threading</span></code></a> module;</li>
<li>an interface for passing work off to a threadpool, for times when
you absolutely, positively have to use a library that makes blocking
I/O calls.</li>
</ul>
<p>Asynchronous programming is more complex than classical 「sequential」
programming: see the <a class="reference internal" href="asyncio-dev.html#asyncio-dev"><span class="std std-ref">Develop with asyncio</span></a> page which lists
common traps and explains how to avoid them. <a class="reference internal" href="asyncio-dev.html#asyncio-debug-mode"><span class="std std-ref">Enable the debug mode</span></a> during development to detect common issues.</p>
<p>Table of contents:</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="asyncio-eventloop.html">19.5.1. Base Event Loop</a><ul>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloop.html#run-an-event-loop">19.5.1.1. Run an event loop</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloop.html#calls">19.5.1.2. Calls</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloop.html#delayed-calls">19.5.1.3. Delayed calls</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloop.html#futures">19.5.1.4. Futures</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloop.html#tasks">19.5.1.5. Tasks</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloop.html#creating-connections">19.5.1.6. Creating connections</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloop.html#creating-listening-connections">19.5.1.7. Creating listening connections</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloop.html#file-transferring">19.5.1.8. File Transferring</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloop.html#tls-upgrade">19.5.1.9. TLS Upgrade</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloop.html#watch-file-descriptors">19.5.1.10. Watch file descriptors</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloop.html#low-level-socket-operations">19.5.1.11. Low-level socket operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloop.html#resolve-host-name">19.5.1.12. Resolve host name</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloop.html#connect-pipes">19.5.1.13. Connect pipes</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloop.html#unix-signals">19.5.1.14. UNIX signals</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloop.html#executor">19.5.1.15. Executor</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloop.html#error-handling-api">19.5.1.16. Error Handling API</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloop.html#debug-mode">19.5.1.17. Debug mode</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloop.html#server">19.5.1.18. Server</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloop.html#handle">19.5.1.19. Handle</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloop.html#sendfilenotavailableerror">19.5.1.20. SendfileNotAvailableError</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloop.html#event-loop-examples">19.5.1.21. Event loop examples</a><ul>
<li class="toctree-l3"><a class="reference internal" href="asyncio-eventloop.html#hello-world-with-call-soon">19.5.1.21.1. Hello World with call_soon()</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-eventloop.html#display-the-current-date-with-call-later">19.5.1.21.2. Display the current date with call_later()</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-eventloop.html#watch-a-file-descriptor-for-read-events">19.5.1.21.3. Watch a file descriptor for read events</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-eventloop.html#set-signal-handlers-for-sigint-and-sigterm">19.5.1.21.4. Set signal handlers for SIGINT and SIGTERM</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="asyncio-eventloops.html">19.5.2. Event loops</a><ul>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloops.html#event-loop-functions">19.5.2.1. Event loop functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloops.html#available-event-loops">19.5.2.2. Available event loops</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloops.html#platform-support">19.5.2.3. Platform support</a><ul>
<li class="toctree-l3"><a class="reference internal" href="asyncio-eventloops.html#windows">19.5.2.3.1. Windows</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-eventloops.html#mac-os-x">19.5.2.3.2. Mac OS X</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloops.html#event-loop-policies-and-the-default-policy">19.5.2.4. Event loop policies and the default policy</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloops.html#event-loop-policy-interface">19.5.2.5. Event loop policy interface</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloops.html#access-to-the-global-loop-policy">19.5.2.6. Access to the global loop policy</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-eventloops.html#customizing-the-event-loop-policy">19.5.2.7. Customizing the event loop policy</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="asyncio-task.html">19.5.3. Tasks and coroutines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="asyncio-task.html#coroutines">19.5.3.1. Coroutines</a><ul>
<li class="toctree-l3"><a class="reference internal" href="asyncio-task.html#example-hello-world-coroutine">19.5.3.1.1. Example: Hello World coroutine</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-task.html#example-coroutine-displaying-the-current-date">19.5.3.1.2. Example: Coroutine displaying the current date</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-task.html#example-chain-coroutines">19.5.3.1.3. Example: Chain coroutines</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-task.html#invalidstateerror">19.5.3.2. InvalidStateError</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-task.html#timeouterror">19.5.3.3. TimeoutError</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-task.html#future">19.5.3.4. Future</a><ul>
<li class="toctree-l3"><a class="reference internal" href="asyncio-task.html#example-future-with-run-until-complete">19.5.3.4.1. Example: Future with run_until_complete()</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-task.html#example-future-with-run-forever">19.5.3.4.2. Example: Future with run_forever()</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-task.html#task">19.5.3.5. Task</a><ul>
<li class="toctree-l3"><a class="reference internal" href="asyncio-task.html#example-parallel-execution-of-tasks">19.5.3.5.1. Example: Parallel execution of tasks</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-task.html#task-functions">19.5.3.6. Task functions</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="asyncio-protocol.html">19.5.4. Transports and protocols (callback based API)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="asyncio-protocol.html#transports">19.5.4.1. Transports</a><ul>
<li class="toctree-l3"><a class="reference internal" href="asyncio-protocol.html#basetransport">19.5.4.1.1. BaseTransport</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-protocol.html#readtransport">19.5.4.1.2. ReadTransport</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-protocol.html#writetransport">19.5.4.1.3. WriteTransport</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-protocol.html#datagramtransport">19.5.4.1.4. DatagramTransport</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-protocol.html#basesubprocesstransport">19.5.4.1.5. BaseSubprocessTransport</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-protocol.html#protocols">19.5.4.2. Protocols</a><ul>
<li class="toctree-l3"><a class="reference internal" href="asyncio-protocol.html#protocol-classes">19.5.4.2.1. Protocol classes</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-protocol.html#connection-callbacks">19.5.4.2.2. Connection callbacks</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-protocol.html#streaming-protocols">19.5.4.2.3. Streaming protocols</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-protocol.html#streaming-protocols-with-manual-receive-buffer-control">19.5.4.2.4. Streaming protocols with manual receive buffer control</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-protocol.html#datagram-protocols">19.5.4.2.5. Datagram protocols</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-protocol.html#flow-control-callbacks">19.5.4.2.6. Flow control callbacks</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-protocol.html#coroutines-and-protocols">19.5.4.2.7. Coroutines and protocols</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-protocol.html#protocol-examples">19.5.4.3. Protocol examples</a><ul>
<li class="toctree-l3"><a class="reference internal" href="asyncio-protocol.html#tcp-echo-client-protocol">19.5.4.3.1. TCP echo client protocol</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-protocol.html#tcp-echo-server-protocol">19.5.4.3.2. TCP echo server protocol</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-protocol.html#udp-echo-client-protocol">19.5.4.3.3. UDP echo client protocol</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-protocol.html#udp-echo-server-protocol">19.5.4.3.4. UDP echo server protocol</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-protocol.html#register-an-open-socket-to-wait-for-data-using-a-protocol">19.5.4.3.5. Register an open socket to wait for data using a protocol</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="asyncio-stream.html">19.5.5. Streams (coroutine based API)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="asyncio-stream.html#stream-functions">19.5.5.1. Stream functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-stream.html#streamreader">19.5.5.2. StreamReader</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-stream.html#streamwriter">19.5.5.3. StreamWriter</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-stream.html#streamreaderprotocol">19.5.5.4. StreamReaderProtocol</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-stream.html#incompletereaderror">19.5.5.5. IncompleteReadError</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-stream.html#limitoverrunerror">19.5.5.6. LimitOverrunError</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-stream.html#stream-examples">19.5.5.7. Stream examples</a><ul>
<li class="toctree-l3"><a class="reference internal" href="asyncio-stream.html#tcp-echo-client-using-streams">19.5.5.7.1. TCP echo client using streams</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-stream.html#tcp-echo-server-using-streams">19.5.5.7.2. TCP echo server using streams</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-stream.html#get-http-headers">19.5.5.7.3. Get HTTP headers</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-stream.html#register-an-open-socket-to-wait-for-data-using-streams">19.5.5.7.4. Register an open socket to wait for data using streams</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="asyncio-subprocess.html">19.5.6. 子程序</a><ul>
<li class="toctree-l2"><a class="reference internal" href="asyncio-subprocess.html#windows-event-loop">19.5.6.1. Windows event loop</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-subprocess.html#create-a-subprocess-high-level-api-using-process">19.5.6.2. Create a subprocess: high-level API using Process</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-subprocess.html#create-a-subprocess-low-level-api-using-subprocess-popen">19.5.6.3. Create a subprocess: low-level API using subprocess.Popen</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-subprocess.html#constants">19.5.6.4. Constants</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-subprocess.html#process">19.5.6.5. Process</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-subprocess.html#subprocess-and-threads">19.5.6.6. Subprocess and threads</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-subprocess.html#subprocess-examples">19.5.6.7. Subprocess examples</a><ul>
<li class="toctree-l3"><a class="reference internal" href="asyncio-subprocess.html#subprocess-using-transport-and-protocol">19.5.6.7.1. Subprocess using transport and protocol</a></li>
<li class="toctree-l3"><a class="reference internal" href="asyncio-subprocess.html#subprocess-using-streams">19.5.6.7.2. Subprocess using streams</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="asyncio-sync.html">19.5.7. Synchronization primitives</a><ul>
<li class="toctree-l2"><a class="reference internal" href="asyncio-sync.html#lock">19.5.7.1. Lock</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-sync.html#event">19.5.7.2. Event</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-sync.html#condition">19.5.7.3. Condition</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-sync.html#semaphore">19.5.7.4. Semaphore</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-sync.html#boundedsemaphore">19.5.7.5. BoundedSemaphore</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-sync.html#using-locks-conditions-and-semaphores-in-the-async-with-statement">19.5.7.6. Using locks, conditions and semaphores in the <code class="docutils literal notranslate"><span class="pre">async</span> <span class="pre">with</span></code> statement</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="asyncio-queue.html">19.5.8. Queues</a><ul>
<li class="toctree-l2"><a class="reference internal" href="asyncio-queue.html#queue">19.5.8.1. Queue</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-queue.html#priorityqueue">19.5.8.2. PriorityQueue</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-queue.html#lifoqueue">19.5.8.3. LifoQueue</a><ul>
<li class="toctree-l3"><a class="reference internal" href="asyncio-queue.html#exceptions">19.5.8.3.1. Exceptions</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="asyncio-dev.html">19.5.9. Develop with asyncio</a><ul>
<li class="toctree-l2"><a class="reference internal" href="asyncio-dev.html#debug-mode-of-asyncio">19.5.9.1. Debug mode of asyncio</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-dev.html#cancellation">19.5.9.2. Cancellation</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-dev.html#concurrency-and-multithreading">19.5.9.3. Concurrency and multithreading</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-dev.html#handle-blocking-functions-correctly">19.5.9.4. Handle blocking functions correctly</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-dev.html#logging">19.5.9.5. Logging</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-dev.html#detect-coroutine-objects-never-scheduled">19.5.9.6. Detect coroutine objects never scheduled</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-dev.html#detect-exceptions-never-consumed">19.5.9.7. Detect exceptions never consumed</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-dev.html#chain-coroutines-correctly">19.5.9.8. Chain coroutines correctly</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-dev.html#pending-task-destroyed">19.5.9.9. Pending task destroyed</a></li>
<li class="toctree-l2"><a class="reference internal" href="asyncio-dev.html#close-transports-and-event-loops">19.5.9.10. Close transports and event loops</a></li>
</ul>
</li>
</ul>
</div>
<div class="admonition seealso">
<p class="first admonition-title">也參考</p>
<p class="last">The <a class="reference internal" href="#module-asyncio" title="asyncio: Asynchronous I/O, event loop, coroutines and tasks."><code class="xref py py-mod docutils literal notranslate"><span class="pre">asyncio</span></code></a> module was designed in <span class="target" id="index-1"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-3156"><strong>PEP 3156</strong></a>. For a
motivational primer on transports and protocols, see <span class="target" id="index-2"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-3153"><strong>PEP 3153</strong></a>.</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>上個主題</h4>
<p class="topless"><a href="selectors.html"
title="上一章">19.4. <code class="docutils literal notranslate"><span class="pre">selectors</span></code> — High-level I/O multiplexing</a></p>
<h4>下個主題</h4>
<p class="topless"><a href="asyncio-eventloop.html"
title="下一章">19.5.1. Base Event Loop</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../bugs.html">Report a Bug</a></li>
<li>
<a href="https://github.com/python/cpython/blob/3.7/Doc/library/asyncio.rst"
rel="nofollow">Show Source
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>瀏覽</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>索引</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python 模組索引"
>模組</a> |</li>
<li class="right" >
<a href="asyncio-eventloop.html" title="19.5.1. Base Event Loop"
>下一頁</a> |</li>
<li class="right" >
<a href="selectors.html" title="19.4. selectors — High-level I/O multiplexing"
>上一頁</a> |</li>
<li><img src="../_static/py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="https://www.python.org/">Python</a> »</li>
<li>
<span class="language_switcher_placeholder">zh_TW</span>
<span class="version_switcher_placeholder">3.7.0</span>
<a href="../index.html">Documentation </a> »
</li>
<li class="nav-item nav-item-1"><a href="index.html" >Python 標準函式庫 (Standard Library)</a> »</li>
<li class="nav-item nav-item-2"><a href="ipc.html" >19. Interprocess Communication and Networking</a> »</li>
<li class="right">
<div class="inline-search" style="display: none" role="search">
<form class="inline-search" action="../search.html" method="get">
<input placeholder="Quick search" type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('.inline-search').show(0);</script>
|
</li>
</ul>
</div>
<div class="footer">
© <a href="../copyright.html">Copyright</a> 2001-2018, Python Software Foundation.
<br />
The Python Software Foundation is a non-profit corporation.
<a href="https://www.python.org/psf/donations/">Please donate.</a>
<br />
Last updated on 8月 22, 2018.
<a href="../bugs.html">Found a bug</a>?
<br />
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.7.7.
</div>
</body>
</html>