parthtamu/rag-code-assistant
0
1<!DOCTYPE html>2 3<html lang="en" data-content_root="../">4 <head>5 <meta charset="utf-8" />6 <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />7<meta property="og:title" content="High-level API Index" />8<meta property="og:type" content="website" />9<meta property="og:url" content="https://docs.python.org/3/library/asyncio-api-index.html" />10<meta property="og:site_name" content="Python documentation" />11<meta property="og:description" content="This page lists all high-level async/await enabled asyncio APIs. Tasks: Utilities to run asyncio programs, create Tasks, and await on multiple things with timeouts.,, run(), Create event loop, run ..." />12<meta property="og:image:width" content="1146" />13<meta property="og:image:height" content="600" />14<meta property="og:image" content="https://docs.python.org/3.15/_images/social_previews/summary_library_asyncio-api-index_4ed6e667.png" />15<meta property="og:image:alt" content="This page lists all high-level async/await enabled asyncio APIs. Tasks: Utilities to run asyncio programs, create Tasks, and await on multiple things with timeouts.,, run(), Create event loop, run ..." />16<meta name="description" content="This page lists all high-level async/await enabled asyncio APIs. Tasks: Utilities to run asyncio programs, create Tasks, and await on multiple things with timeouts.,, run(), Create event loop, run ..." />17<meta name="twitter:card" content="summary_large_image" />18<meta name="theme-color" content="#3776ab">19 20 <title>High-level API Index — Python 3.15.0a6 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">21 22 <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=b86133f3" />23 <link rel="stylesheet" type="text/css" href="../_static/classic.css?v=234b1a7c" />24 <link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=89a2f22a" />25 <link rel="stylesheet" type="text/css" href="../_static/profiling-sampling-visualization.css?v=0c2600ae" />26 <link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=5349f25f" />27 28 <script src="../_static/documentation_options.js?v=6b7c9ff5"></script>29 <script src="../_static/doctools.js?v=9bcbadda"></script>30 <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>31 <script src="../_static/profiling-sampling-visualization.js?v=9811ed04"></script>32 33 <script src="../_static/sidebar.js"></script>34 35 <link rel="search" type="application/opensearchdescription+xml"36 title="Search within Python 3.15.0a6 documentation"37 href="../_static/opensearch.xml"/>38 <link rel="author" title="About these documents" href="../about.html" />39 <link rel="index" title="Index" href="../genindex.html" />40 <link rel="search" title="Search" href="../search.html" />41 <link rel="copyright" title="Copyright" href="../copyright.html" />42 <link rel="next" title="Low-level API Index" href="asyncio-llapi-index.html" />43 <link rel="prev" title="Extending" href="asyncio-extending.html" />44 45 46 <script defer file-types="bz2,epub,zip" data-domain="docs.python.org" src="https://analytics.python.org/js/script.file-downloads.outbound-links.js"></script>47 48 <link rel="canonical" href="https://docs.python.org/3/library/asyncio-api-index.html">49 50 51 52 53 <style>54 @media only screen {55 table.full-width-table {56 width: 100%;57 }58 }59 </style>60<link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">61 <link rel="shortcut icon" type="image/png" href="../_static/py.svg">62 <script type="text/javascript" src="../_static/copybutton.js"></script>63 <script type="text/javascript" src="../_static/menu.js"></script>64 <script type="text/javascript" src="../_static/search-focus.js"></script>65 <script type="text/javascript" src="../_static/themetoggle.js"></script> 66 <script type="text/javascript" src="../_static/rtd_switcher.js"></script>67 <meta name="readthedocs-addons-api-version" content="1">68 69 </head>70<body>71<div class="mobile-nav">72 <input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"73 aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu">74 <nav class="nav-content" role="navigation">75 <label for="menuToggler" class="toggler__label">76 <span></span>77 </label>78 <span class="nav-items-wrapper">79 <a href="https://www.python.org/" class="nav-logo">80 <img src="../_static/py.svg" alt="Python logo">81 </a>82 <span class="version_switcher_placeholder"></span>83 <form role="search" class="search" action="../search.html" method="get">84 <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">85 <path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>86 </svg>87 <input placeholder="Quick search" aria-label="Quick search" type="search" name="q">88 <input type="submit" value="Go">89 </form>90 </span>91 </nav>92 <div class="menu-wrapper">93 <nav class="menu" role="navigation" aria-label="main navigation">94 <div class="language_switcher_placeholder"></div>95 96<label class="theme-selector-label">97 Theme98 <select class="theme-selector" oninput="activateTheme(this.value)">99 <option value="auto" selected>Auto</option>100 <option value="light">Light</option>101 <option value="dark">Dark</option>102 </select>103</label>104 <div>105 <h3><a href="../contents.html">Table of Contents</a></h3>106 <ul>107<li><a class="reference internal" href="#">High-level API Index</a><ul>108<li><a class="reference internal" href="#tasks">Tasks</a></li>109<li><a class="reference internal" href="#queues">Queues</a></li>110<li><a class="reference internal" href="#subprocesses">Subprocesses</a></li>111<li><a class="reference internal" href="#streams">Streams</a></li>112<li><a class="reference internal" href="#synchronization">Synchronization</a></li>113<li><a class="reference internal" href="#exceptions">Exceptions</a></li>114</ul>115</li>116</ul>117 118 </div>119 <div>120 <h4>Previous topic</h4>121 <p class="topless"><a href="asyncio-extending.html"122 title="previous chapter">Extending</a></p>123 </div>124 <div>125 <h4>Next topic</h4>126 <p class="topless"><a href="asyncio-llapi-index.html"127 title="next chapter">Low-level API Index</a></p>128 </div>129 <script>130 document.addEventListener('DOMContentLoaded', () => {131 const title = document.querySelector('meta[property="og:title"]').content;132 const elements = document.querySelectorAll('.improvepage');133 const pageurl = window.location.href.split('?')[0];134 elements.forEach(element => {135 const url = new URL(element.href.split('?')[0].replace("-nojs", ""));136 url.searchParams.set('pagetitle', title);137 url.searchParams.set('pageurl', pageurl);138 url.searchParams.set('pagesource', "library/asyncio-api-index.rst");139 element.href = url.toString();140 });141 });142 </script>143 <div role="note" aria-label="source link">144 <h3>This page</h3>145 <ul class="this-page-menu">146 <li><a href="../bugs.html">Report a bug</a></li>147 <li><a class="improvepage" href="../improve-page-nojs.html">Improve this page</a></li>148 <li>149 <a href="https://github.com/python/cpython/blob/main/Doc/library/asyncio-api-index.rst?plain=1"150 rel="nofollow">Show source151 </a>152 </li>153 154 </ul>155 </div>156 </nav>157 </div>158</div>159 160 161 <div class="related" role="navigation" aria-label="Related">162 <h3>Navigation</h3>163 <ul>164 <li class="right" style="margin-right: 10px">165 <a href="../genindex.html" title="General Index"166 accesskey="I">index</a></li>167 <li class="right" >168 <a href="../py-modindex.html" title="Python Module Index"169 >modules</a> |</li>170 <li class="right" >171 <a href="asyncio-llapi-index.html" title="Low-level API Index"172 accesskey="N">next</a> |</li>173 <li class="right" >174 <a href="asyncio-extending.html" title="Extending"175 accesskey="P">previous</a> |</li>176 177 <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"></li>178 <li><a href="https://www.python.org/">Python</a> »</li>179 <li class="switchers">180 <div class="language_switcher_placeholder"></div>181 <div class="version_switcher_placeholder"></div>182 </li>183 <li>184 185 </li>186 <li id="cpython-language-and-version">187 <a href="../index.html">3.15.0a6 Documentation</a> »188 </li>189 190 <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>191 <li class="nav-item nav-item-2"><a href="ipc.html" >Networking and Interprocess Communication</a> »</li>192 <li class="nav-item nav-item-3"><a href="asyncio.html" accesskey="U"><code class="xref py py-mod docutils literal notranslate"><span class="pre">asyncio</span></code> — Asynchronous I/O</a> »</li>193 <li class="nav-item nav-item-this"><a href="">High-level API Index</a></li>194 <li class="right">195 196 197 <div class="inline-search" role="search">198 <form class="inline-search" action="../search.html" method="get">199 <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box">200 <input type="submit" value="Go">201 </form>202 </div>203 |204 </li>205 <li class="right">206<label class="theme-selector-label">207 Theme208 <select class="theme-selector" oninput="activateTheme(this.value)">209 <option value="auto" selected>Auto</option>210 <option value="light">Light</option>211 <option value="dark">Dark</option>212 </select>213</label> |</li>214 215 </ul>216 </div> 217 218 <div class="document">219 <div class="documentwrapper">220 <div class="bodywrapper">221 <div class="body" role="main">222 223 <section id="high-level-api-index">224<h1>High-level API Index<a class="headerlink" href="#high-level-api-index" title="Link to this heading">¶</a></h1>225<p>This page lists all high-level async/await enabled asyncio APIs.</p>226<section id="tasks">227<h2>Tasks<a class="headerlink" href="#tasks" title="Link to this heading">¶</a></h2>228<p>Utilities to run asyncio programs, create Tasks, and229await on multiple things with timeouts.</p>230<table class="full-width-table docutils align-default">231<colgroup>232<col style="width: 50.0%" />233<col style="width: 50.0%" />234</colgroup>235<tbody>236<tr class="row-odd"><td><p><a class="reference internal" href="asyncio-runner.html#asyncio.run" title="asyncio.run"><code class="xref py py-func docutils literal notranslate"><span class="pre">run()</span></code></a></p></td>237<td><p>Create event loop, run a coroutine, close the loop.</p></td>238</tr>239<tr class="row-even"><td><p><a class="reference internal" href="asyncio-runner.html#asyncio.Runner" title="asyncio.Runner"><code class="xref py py-class docutils literal notranslate"><span class="pre">Runner</span></code></a></p></td>240<td><p>A context manager that simplifies multiple async function calls.</p></td>241</tr>242<tr class="row-odd"><td><p><a class="reference internal" href="asyncio-task.html#asyncio.Task" title="asyncio.Task"><code class="xref py py-class docutils literal notranslate"><span class="pre">Task</span></code></a></p></td>243<td><p>Task object.</p></td>244</tr>245<tr class="row-even"><td><p><a class="reference internal" href="asyncio-task.html#asyncio.TaskGroup" title="asyncio.TaskGroup"><code class="xref py py-class docutils literal notranslate"><span class="pre">TaskGroup</span></code></a></p></td>246<td><p>A context manager that holds a group of tasks. Provides247a convenient and reliable way to wait for all tasks in the group to248finish.</p></td>249</tr>250<tr class="row-odd"><td><p><a class="reference internal" href="asyncio-task.html#asyncio.create_task" title="asyncio.create_task"><code class="xref py py-func docutils literal notranslate"><span class="pre">create_task()</span></code></a></p></td>251<td><p>Start an asyncio Task, then returns it.</p></td>252</tr>253<tr class="row-even"><td><p><a class="reference internal" href="asyncio-task.html#asyncio.current_task" title="asyncio.current_task"><code class="xref py py-func docutils literal notranslate"><span class="pre">current_task()</span></code></a></p></td>254<td><p>Return the current Task.</p></td>255</tr>256<tr class="row-odd"><td><p><a class="reference internal" href="asyncio-task.html#asyncio.all_tasks" title="asyncio.all_tasks"><code class="xref py py-func docutils literal notranslate"><span class="pre">all_tasks()</span></code></a></p></td>257<td><p>Return all tasks that are not yet finished for an event loop.</p></td>258</tr>259<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">await</span></code> <a class="reference internal" href="asyncio-task.html#asyncio.sleep" title="asyncio.sleep"><code class="xref py py-func docutils literal notranslate"><span class="pre">sleep()</span></code></a></p></td>260<td><p>Sleep for a number of seconds.</p></td>261</tr>262<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">await</span></code> <a class="reference internal" href="asyncio-task.html#asyncio.gather" title="asyncio.gather"><code class="xref py py-func docutils literal notranslate"><span class="pre">gather()</span></code></a></p></td>263<td><p>Schedule and wait for things concurrently.</p></td>264</tr>265<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">await</span></code> <a class="reference internal" href="asyncio-task.html#asyncio.wait_for" title="asyncio.wait_for"><code class="xref py py-func docutils literal notranslate"><span class="pre">wait_for()</span></code></a></p></td>266<td><p>Run with a timeout.</p></td>267</tr>268<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">await</span></code> <a class="reference internal" href="asyncio-task.html#asyncio.shield" title="asyncio.shield"><code class="xref py py-func docutils literal notranslate"><span class="pre">shield()</span></code></a></p></td>269<td><p>Shield from cancellation.</p></td>270</tr>271<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">await</span></code> <a class="reference internal" href="asyncio-task.html#asyncio.wait" title="asyncio.wait"><code class="xref py py-func docutils literal notranslate"><span class="pre">wait()</span></code></a></p></td>272<td><p>Monitor for completion.</p></td>273</tr>274<tr class="row-odd"><td><p><a class="reference internal" href="asyncio-task.html#asyncio.timeout" title="asyncio.timeout"><code class="xref py py-func docutils literal notranslate"><span class="pre">timeout()</span></code></a></p></td>275<td><p>Run with a timeout. Useful in cases when <code class="docutils literal notranslate"><span class="pre">wait_for</span></code> is not suitable.</p></td>276</tr>277<tr class="row-even"><td><p><a class="reference internal" href="asyncio-task.html#asyncio.to_thread" title="asyncio.to_thread"><code class="xref py py-func docutils literal notranslate"><span class="pre">to_thread()</span></code></a></p></td>278<td><p>Asynchronously run a function in a separate OS thread.</p></td>279</tr>280<tr class="row-odd"><td><p><a class="reference internal" href="asyncio-task.html#asyncio.run_coroutine_threadsafe" title="asyncio.run_coroutine_threadsafe"><code class="xref py py-func docutils literal notranslate"><span class="pre">run_coroutine_threadsafe()</span></code></a></p></td>281<td><p>Schedule a coroutine from another OS thread.</p></td>282</tr>283<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">for</span> <span class="pre">in</span></code> <a class="reference internal" href="asyncio-task.html#asyncio.as_completed" title="asyncio.as_completed"><code class="xref py py-func docutils literal notranslate"><span class="pre">as_completed()</span></code></a></p></td>284<td><p>Monitor for completion with a <code class="docutils literal notranslate"><span class="pre">for</span></code> loop.</p></td>285</tr>286</tbody>287</table>288<p class="rubric">Examples</p>289<ul class="simple">290<li><p><a class="reference internal" href="asyncio-task.html#asyncio-example-gather"><span class="std std-ref">Using asyncio.gather() to run things in parallel</span></a>.</p></li>291<li><p><a class="reference internal" href="asyncio-task.html#asyncio-example-waitfor"><span class="std std-ref">Using asyncio.wait_for() to enforce a timeout</span></a>.</p></li>292<li><p><a class="reference internal" href="asyncio-task.html#asyncio-example-task-cancel"><span class="std std-ref">Cancellation</span></a>.</p></li>293<li><p><a class="reference internal" href="asyncio-task.html#asyncio-example-sleep"><span class="std std-ref">Using asyncio.sleep()</span></a>.</p></li>294<li><p>See also the main <a class="reference internal" href="asyncio-task.html#coroutine"><span class="std std-ref">Tasks documentation page</span></a>.</p></li>295</ul>296</section>297<section id="queues">298<h2>Queues<a class="headerlink" href="#queues" title="Link to this heading">¶</a></h2>299<p>Queues should be used to distribute work amongst multiple asyncio Tasks,300implement connection pools, and pub/sub patterns.</p>301<table class="full-width-table docutils align-default">302<colgroup>303<col style="width: 50.0%" />304<col style="width: 50.0%" />305</colgroup>306<tbody>307<tr class="row-odd"><td><p><a class="reference internal" href="asyncio-queue.html#asyncio.Queue" title="asyncio.Queue"><code class="xref py py-class docutils literal notranslate"><span class="pre">Queue</span></code></a></p></td>308<td><p>A FIFO queue.</p></td>309</tr>310<tr class="row-even"><td><p><a class="reference internal" href="asyncio-queue.html#asyncio.PriorityQueue" title="asyncio.PriorityQueue"><code class="xref py py-class docutils literal notranslate"><span class="pre">PriorityQueue</span></code></a></p></td>311<td><p>A priority queue.</p></td>312</tr>313<tr class="row-odd"><td><p><a class="reference internal" href="asyncio-queue.html#asyncio.LifoQueue" title="asyncio.LifoQueue"><code class="xref py py-class docutils literal notranslate"><span class="pre">LifoQueue</span></code></a></p></td>314<td><p>A LIFO queue.</p></td>315</tr>316</tbody>317</table>318<p class="rubric">Examples</p>319<ul class="simple">320<li><p><a class="reference internal" href="asyncio-queue.html#asyncio-example-queue-dist"><span class="std std-ref">Using asyncio.Queue to distribute workload between several321Tasks</span></a>.</p></li>322<li><p>See also the <a class="reference internal" href="asyncio-queue.html#asyncio-queues"><span class="std std-ref">Queues documentation page</span></a>.</p></li>323</ul>324</section>325<section id="subprocesses">326<h2>Subprocesses<a class="headerlink" href="#subprocesses" title="Link to this heading">¶</a></h2>327<p>Utilities to spawn subprocesses and run shell commands.</p>328<table class="full-width-table docutils align-default">329<colgroup>330<col style="width: 50.0%" />331<col style="width: 50.0%" />332</colgroup>333<tbody>334<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">await</span></code> <a class="reference internal" href="asyncio-subprocess.html#asyncio.create_subprocess_exec" title="asyncio.create_subprocess_exec"><code class="xref py py-func docutils literal notranslate"><span class="pre">create_subprocess_exec()</span></code></a></p></td>335<td><p>Create a subprocess.</p></td>336</tr>337<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">await</span></code> <a class="reference internal" href="asyncio-subprocess.html#asyncio.create_subprocess_shell" title="asyncio.create_subprocess_shell"><code class="xref py py-func docutils literal notranslate"><span class="pre">create_subprocess_shell()</span></code></a></p></td>338<td><p>Run a shell command.</p></td>339</tr>340</tbody>341</table>342<p class="rubric">Examples</p>343<ul class="simple">344<li><p><a class="reference internal" href="asyncio-subprocess.html#asyncio-example-subprocess-shell"><span class="std std-ref">Executing a shell command</span></a>.</p></li>345<li><p>See also the <a class="reference internal" href="asyncio-subprocess.html#asyncio-subprocess"><span class="std std-ref">subprocess APIs</span></a>346documentation.</p></li>347</ul>348</section>349<section id="streams">350<h2>Streams<a class="headerlink" href="#streams" title="Link to this heading">¶</a></h2>351<p>High-level APIs to work with network IO.</p>352<table class="full-width-table docutils align-default">353<colgroup>354<col style="width: 50.0%" />355<col style="width: 50.0%" />356</colgroup>357<tbody>358<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">await</span></code> <a class="reference internal" href="asyncio-stream.html#asyncio.open_connection" title="asyncio.open_connection"><code class="xref py py-func docutils literal notranslate"><span class="pre">open_connection()</span></code></a></p></td>359<td><p>Establish a TCP connection.</p></td>360</tr>361<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">await</span></code> <a class="reference internal" href="asyncio-stream.html#asyncio.open_unix_connection" title="asyncio.open_unix_connection"><code class="xref py py-func docutils literal notranslate"><span class="pre">open_unix_connection()</span></code></a></p></td>362<td><p>Establish a Unix socket connection.</p></td>363</tr>364<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">await</span></code> <a class="reference internal" href="asyncio-stream.html#asyncio.start_server" title="asyncio.start_server"><code class="xref py py-func docutils literal notranslate"><span class="pre">start_server()</span></code></a></p></td>365<td><p>Start a TCP server.</p></td>366</tr>367<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">await</span></code> <a class="reference internal" href="asyncio-stream.html#asyncio.start_unix_server" title="asyncio.start_unix_server"><code class="xref py py-func docutils literal notranslate"><span class="pre">start_unix_server()</span></code></a></p></td>368<td><p>Start a Unix socket server.</p></td>369</tr>370<tr class="row-odd"><td><p><a class="reference internal" href="asyncio-stream.html#asyncio.StreamReader" title="asyncio.StreamReader"><code class="xref py py-class docutils literal notranslate"><span class="pre">StreamReader</span></code></a></p></td>371<td><p>High-level async/await object to receive network data.</p></td>372</tr>373<tr class="row-even"><td><p><a class="reference internal" href="asyncio-stream.html#asyncio.StreamWriter" title="asyncio.StreamWriter"><code class="xref py py-class docutils literal notranslate"><span class="pre">StreamWriter</span></code></a></p></td>374<td><p>High-level async/await object to send network data.</p></td>375</tr>376</tbody>377</table>378<p class="rubric">Examples</p>379<ul class="simple">380<li><p><a class="reference internal" href="asyncio-stream.html#asyncio-example-stream"><span class="std std-ref">Example TCP client</span></a>.</p></li>381<li><p>See also the <a class="reference internal" href="asyncio-stream.html#asyncio-streams"><span class="std std-ref">streams APIs</span></a>382documentation.</p></li>383</ul>384</section>385<section id="synchronization">386<h2>Synchronization<a class="headerlink" href="#synchronization" title="Link to this heading">¶</a></h2>387<p>Threading-like synchronization primitives that can be used in Tasks.</p>388<table class="full-width-table docutils align-default">389<colgroup>390<col style="width: 50.0%" />391<col style="width: 50.0%" />392</colgroup>393<tbody>394<tr class="row-odd"><td><p><a class="reference internal" href="asyncio-sync.html#asyncio.Lock" title="asyncio.Lock"><code class="xref py py-class docutils literal notranslate"><span class="pre">Lock</span></code></a></p></td>395<td><p>A mutex lock.</p></td>396</tr>397<tr class="row-even"><td><p><a class="reference internal" href="asyncio-sync.html#asyncio.Event" title="asyncio.Event"><code class="xref py py-class docutils literal notranslate"><span class="pre">Event</span></code></a></p></td>398<td><p>An event object.</p></td>399</tr>400<tr class="row-odd"><td><p><a class="reference internal" href="asyncio-sync.html#asyncio.Condition" title="asyncio.Condition"><code class="xref py py-class docutils literal notranslate"><span class="pre">Condition</span></code></a></p></td>401<td><p>A condition object.</p></td>402</tr>403<tr class="row-even"><td><p><a class="reference internal" href="asyncio-sync.html#asyncio.Semaphore" title="asyncio.Semaphore"><code class="xref py py-class docutils literal notranslate"><span class="pre">Semaphore</span></code></a></p></td>404<td><p>A semaphore.</p></td>405</tr>406<tr class="row-odd"><td><p><a class="reference internal" href="asyncio-sync.html#asyncio.BoundedSemaphore" title="asyncio.BoundedSemaphore"><code class="xref py py-class docutils literal notranslate"><span class="pre">BoundedSemaphore</span></code></a></p></td>407<td><p>A bounded semaphore.</p></td>408</tr>409<tr class="row-even"><td><p><a class="reference internal" href="asyncio-sync.html#asyncio.Barrier" title="asyncio.Barrier"><code class="xref py py-class docutils literal notranslate"><span class="pre">Barrier</span></code></a></p></td>410<td><p>A barrier object.</p></td>411</tr>412</tbody>413</table>414<p class="rubric">Examples</p>415<ul class="simple">416<li><p><a class="reference internal" href="asyncio-sync.html#asyncio-example-sync-event"><span class="std std-ref">Using asyncio.Event</span></a>.</p></li>417<li><p><a class="reference internal" href="asyncio-sync.html#asyncio-example-barrier"><span class="std std-ref">Using asyncio.Barrier</span></a>.</p></li>418<li><p>See also the documentation of asyncio419<a class="reference internal" href="asyncio-sync.html#asyncio-sync"><span class="std std-ref">synchronization primitives</span></a>.</p></li>420</ul>421</section>422<section id="exceptions">423<h2>Exceptions<a class="headerlink" href="#exceptions" title="Link to this heading">¶</a></h2>424<table class="full-width-table docutils align-default">425<colgroup>426<col style="width: 50.0%" />427<col style="width: 50.0%" />428</colgroup>429<tbody>430<tr class="row-odd"><td><p><a class="reference internal" href="asyncio-exceptions.html#asyncio.CancelledError" title="asyncio.CancelledError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">asyncio.CancelledError</span></code></a></p></td>431<td><p>Raised when a Task is cancelled. See also <a class="reference internal" href="asyncio-task.html#asyncio.Task.cancel" title="asyncio.Task.cancel"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Task.cancel()</span></code></a>.</p></td>432</tr>433<tr class="row-even"><td><p><a class="reference internal" href="asyncio-sync.html#asyncio.BrokenBarrierError" title="asyncio.BrokenBarrierError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">asyncio.BrokenBarrierError</span></code></a></p></td>434<td><p>Raised when a Barrier is broken. See also <a class="reference internal" href="asyncio-sync.html#asyncio.Barrier.wait" title="asyncio.Barrier.wait"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Barrier.wait()</span></code></a>.</p></td>435</tr>436</tbody>437</table>438<p class="rubric">Examples</p>439<ul class="simple">440<li><p><a class="reference internal" href="asyncio-task.html#asyncio-example-task-cancel"><span class="std std-ref">Handling CancelledError to run code on cancellation request</span></a>.</p></li>441<li><p>See also the full list of442<a class="reference internal" href="asyncio-exceptions.html#asyncio-exceptions"><span class="std std-ref">asyncio-specific exceptions</span></a>.</p></li>443</ul>444</section>445</section>446 447 448 <div class="clearer"></div>449 </div>450 </div>451 </div>452 <div class="sphinxsidebar" role="navigation" aria-label="Main">453 <div class="sphinxsidebarwrapper">454 <div>455 <h3><a href="../contents.html">Table of Contents</a></h3>456 <ul>457<li><a class="reference internal" href="#">High-level API Index</a><ul>458<li><a class="reference internal" href="#tasks">Tasks</a></li>459<li><a class="reference internal" href="#queues">Queues</a></li>460<li><a class="reference internal" href="#subprocesses">Subprocesses</a></li>461<li><a class="reference internal" href="#streams">Streams</a></li>462<li><a class="reference internal" href="#synchronization">Synchronization</a></li>463<li><a class="reference internal" href="#exceptions">Exceptions</a></li>464</ul>465</li>466</ul>467 468 </div>469 <div>470 <h4>Previous topic</h4>471 <p class="topless"><a href="asyncio-extending.html"472 title="previous chapter">Extending</a></p>473 </div>474 <div>475 <h4>Next topic</h4>476 <p class="topless"><a href="asyncio-llapi-index.html"477 title="next chapter">Low-level API Index</a></p>478 </div>479 <script>480 document.addEventListener('DOMContentLoaded', () => {481 const title = document.querySelector('meta[property="og:title"]').content;482 const elements = document.querySelectorAll('.improvepage');483 const pageurl = window.location.href.split('?')[0];484 elements.forEach(element => {485 const url = new URL(element.href.split('?')[0].replace("-nojs", ""));486 url.searchParams.set('pagetitle', title);487 url.searchParams.set('pageurl', pageurl);488 url.searchParams.set('pagesource', "library/asyncio-api-index.rst");489 element.href = url.toString();490 });491 });492 </script>493 <div role="note" aria-label="source link">494 <h3>This page</h3>495 <ul class="this-page-menu">496 <li><a href="../bugs.html">Report a bug</a></li>497 <li><a class="improvepage" href="../improve-page-nojs.html">Improve this page</a></li>498 <li>499 <a href="https://github.com/python/cpython/blob/main/Doc/library/asyncio-api-index.rst?plain=1"500 rel="nofollow">Show source501 </a>502 </li>503 504 </ul>505 </div>506 </div>507<div id="sidebarbutton" title="Collapse sidebar">508<span>«</span>509</div>510 511 </div>512 <div class="clearer"></div>513 </div> 514 <div class="related" role="navigation" aria-label="Related">515 <h3>Navigation</h3>516 <ul>517 <li class="right" style="margin-right: 10px">518 <a href="../genindex.html" title="General Index"519 >index</a></li>520 <li class="right" >521 <a href="../py-modindex.html" title="Python Module Index"522 >modules</a> |</li>523 <li class="right" >524 <a href="asyncio-llapi-index.html" title="Low-level API Index"525 >next</a> |</li>526 <li class="right" >527 <a href="asyncio-extending.html" title="Extending"528 >previous</a> |</li>529 530 <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"></li>531 <li><a href="https://www.python.org/">Python</a> »</li>532 <li class="switchers">533 <div class="language_switcher_placeholder"></div>534 <div class="version_switcher_placeholder"></div>535 </li>536 <li>537 538 </li>539 <li id="cpython-language-and-version">540 <a href="../index.html">3.15.0a6 Documentation</a> »541 </li>542 543 <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>544 <li class="nav-item nav-item-2"><a href="ipc.html" >Networking and Interprocess Communication</a> »</li>545 <li class="nav-item nav-item-3"><a href="asyncio.html" ><code class="xref py py-mod docutils literal notranslate"><span class="pre">asyncio</span></code> — Asynchronous I/O</a> »</li>546 <li class="nav-item nav-item-this"><a href="">High-level API Index</a></li>547 <li class="right">548 549 550 <div class="inline-search" role="search">551 <form class="inline-search" action="../search.html" method="get">552 <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box">553 <input type="submit" value="Go">554 </form>555 </div>556 |557 </li>558 <li class="right">559<label class="theme-selector-label">560 Theme561 <select class="theme-selector" oninput="activateTheme(this.value)">562 <option value="auto" selected>Auto</option>563 <option value="light">Light</option>564 <option value="dark">Dark</option>565 </select>566</label> |</li>567 568 </ul>569 </div> 570 <div class="footer">571 © <a href="../copyright.html">Copyright</a> 2001 Python Software Foundation.572 <br>573 This page is licensed under the Python Software Foundation License Version 2.574 <br>575 Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.576 <br>577 578 See <a href="/license.html">History and License</a> for more information.<br>579 580 581 <br>582 583 The Python Software Foundation is a non-profit corporation.584<a href="https://www.python.org/psf/donations/">Please donate.</a>585<br>586 <br>587 Last updated on Mar 10, 2026 (08:58 UTC).588 589 <a href="/bugs.html">Found a bug</a>?590 591 <br>592 593 Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.594 </div>595 596 </body>597</html>