3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>use_awaitable_t</title>
5 <link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="../../boost_asio.html" title="Boost.Asio">
8 <link rel="up" href="../reference.html" title="Reference">
9 <link rel="prev" href="use_awaitable.html" title="use_awaitable">
10 <link rel="next" href="use_awaitable_t/as_default_on.html" title="use_awaitable_t::as_default_on">
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
15 <td align="center"><a href="../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../more/index.htm">More</a></td>
22 <div class="spirit-nav">
23 <a accesskey="p" href="use_awaitable.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="use_awaitable_t/as_default_on.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
26 <div class="titlepage"><div><div><h3 class="title">
27 <a name="boost_asio.reference.use_awaitable_t"></a><a class="link" href="use_awaitable_t.html" title="use_awaitable_t">use_awaitable_t</a>
28 </h3></div></div></div>
30 A completion token that represents the currently executing coroutine.
32 <pre class="programlisting">template<
33 typename <a class="link" href="Executor1.html" title="Executor requirements">Executor</a> = executor>
34 struct use_awaitable_t
37 <a name="boost_asio.reference.use_awaitable_t.h0"></a>
38 <span class="phrase"><a name="boost_asio.reference.use_awaitable_t.types"></a></span><a class="link" href="use_awaitable_t.html#boost_asio.reference.use_awaitable_t.types">Types</a>
40 <div class="informaltable"><table class="table">
60 <a class="link" href="use_awaitable_t__executor_with_default.html" title="use_awaitable_t::executor_with_default"><span class="bold"><strong>executor_with_default</strong></span></a>
65 Adapts an executor to add the use_awaitable_t completion token
72 <a name="boost_asio.reference.use_awaitable_t.h1"></a>
73 <span class="phrase"><a name="boost_asio.reference.use_awaitable_t.member_functions"></a></span><a class="link" href="use_awaitable_t.html#boost_asio.reference.use_awaitable_t.member_functions">Member Functions</a>
75 <div class="informaltable"><table class="table">
96 <a class="link" href="use_awaitable_t/as_default_on.html" title="use_awaitable_t::as_default_on"><span class="bold"><strong>as_default_on</strong></span></a>
101 Function helper to adapt an I/O object to use use_awaitable_t as
102 its default completion token type.
109 <a class="link" href="use_awaitable_t/use_awaitable_t.html" title="use_awaitable_t::use_awaitable_t"><span class="bold"><strong>use_awaitable_t</strong></span></a>
121 The <code class="computeroutput">use_awaitable_t</code> class, with its value <code class="computeroutput">use_awaitable</code>,
122 is used to represent the currently executing coroutine. This completion token
123 may be passed as a handler to an asynchronous operation. For example:
125 <pre class="programlisting">awaitable<void> my_coroutine()
127 std::size_t n = co_await my_socket.async_read_some(buffer, use_awaitable);
132 When used with co_await, the initiating function (<code class="computeroutput">async_read_some</code>
133 in the above example) suspends the current coroutine. The coroutine is resumed
134 when the asynchronous operation completes, and the result of the operation
138 <a name="boost_asio.reference.use_awaitable_t.h2"></a>
139 <span class="phrase"><a name="boost_asio.reference.use_awaitable_t.requirements"></a></span><a class="link" href="use_awaitable_t.html#boost_asio.reference.use_awaitable_t.requirements">Requirements</a>
142 <span class="emphasis"><em>Header: </em></span><code class="literal">boost/asio/use_awaitable.hpp</code>
145 <span class="emphasis"><em>Convenience header: </em></span><code class="literal">boost/asio.hpp</code>
148 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
149 <td align="left"></td>
150 <td align="right"><div class="copyright-footer">Copyright © 2003-2019 Christopher M. Kohlhoff<p>
151 Distributed under the Boost Software License, Version 1.0. (See accompanying
152 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
157 <div class="spirit-nav">
158 <a accesskey="p" href="use_awaitable.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="use_awaitable_t/as_default_on.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>