Imported Upstream version 1.72.0
[platform/upstream/boost.git] / doc / html / boost_asio / reference / use_awaitable_t__executor_with_default / default_completion_token_type.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>use_awaitable_t::executor_with_default::default_completion_token_type</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="../use_awaitable_t__executor_with_default.html" title="use_awaitable_t::executor_with_default">
9 <link rel="prev" href="../use_awaitable_t__executor_with_default.html" title="use_awaitable_t::executor_with_default">
10 <link rel="next" href="executor_with_default.html" title="use_awaitable_t::executor_with_default::executor_with_default">
11 </head>
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>
20 </tr></table>
21 <hr>
22 <div class="spirit-nav">
23 <a accesskey="p" href="../use_awaitable_t__executor_with_default.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../use_awaitable_t__executor_with_default.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="executor_with_default.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="section">
26 <div class="titlepage"><div><div><h4 class="title">
27 <a name="boost_asio.reference.use_awaitable_t__executor_with_default.default_completion_token_type"></a><a class="link" href="default_completion_token_type.html" title="use_awaitable_t::executor_with_default::default_completion_token_type">use_awaitable_t::executor_with_default::default_completion_token_type</a>
28 </h4></div></div></div>
29 <p>
30           <a class="indexterm" name="boost_asio.indexterm.use_awaitable_t__executor_with_default.default_completion_token_type"></a> 
31 Specify
32           <code class="computeroutput">use_awaitable_t</code> as the default completion token type.
33         </p>
34 <pre class="programlisting">typedef use_awaitable_t default_completion_token_type;
35 </pre>
36 <h6>
37 <a name="boost_asio.reference.use_awaitable_t__executor_with_default.default_completion_token_type.h0"></a>
38           <span class="phrase"><a name="boost_asio.reference.use_awaitable_t__executor_with_default.default_completion_token_type.types"></a></span><a class="link" href="default_completion_token_type.html#boost_asio.reference.use_awaitable_t__executor_with_default.default_completion_token_type.types">Types</a>
39         </h6>
40 <div class="informaltable"><table class="table">
41 <colgroup>
42 <col>
43 <col>
44 </colgroup>
45 <thead><tr>
46 <th>
47                   <p>
48                     Name
49                   </p>
50                 </th>
51 <th>
52                   <p>
53                     Description
54                   </p>
55                 </th>
56 </tr></thead>
57 <tbody><tr>
58 <td>
59                   <p>
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>
61                   </p>
62                 </td>
63 <td>
64                   <p>
65                     Adapts an executor to add the use_awaitable_t completion token
66                     as the default.
67                   </p>
68                 </td>
69 </tr></tbody>
70 </table></div>
71 <h6>
72 <a name="boost_asio.reference.use_awaitable_t__executor_with_default.default_completion_token_type.h1"></a>
73           <span class="phrase"><a name="boost_asio.reference.use_awaitable_t__executor_with_default.default_completion_token_type.member_functions"></a></span><a class="link" href="default_completion_token_type.html#boost_asio.reference.use_awaitable_t__executor_with_default.default_completion_token_type.member_functions">Member
74           Functions</a>
75         </h6>
76 <div class="informaltable"><table class="table">
77 <colgroup>
78 <col>
79 <col>
80 </colgroup>
81 <thead><tr>
82 <th>
83                   <p>
84                     Name
85                   </p>
86                 </th>
87 <th>
88                   <p>
89                     Description
90                   </p>
91                 </th>
92 </tr></thead>
93 <tbody>
94 <tr>
95 <td>
96                   <p>
97                     <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>
98                   </p>
99                 </td>
100 <td>
101                   <p>
102                     Function helper to adapt an I/O object to use use_awaitable_t
103                     as its default completion token type.
104                   </p>
105                 </td>
106 </tr>
107 <tr>
108 <td>
109                   <p>
110                     <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>
111                   </p>
112                 </td>
113 <td>
114                   <p>
115                     Default constructor.
116                   </p>
117                 </td>
118 </tr>
119 </tbody>
120 </table></div>
121 <p>
122           The <code class="computeroutput">use_awaitable_t</code> class, with its value <code class="computeroutput">use_awaitable</code>,
123           is used to represent the currently executing coroutine. This completion
124           token may be passed as a handler to an asynchronous operation. For example:
125         </p>
126 <pre class="programlisting">awaitable&lt;void&gt; my_coroutine()
127 {
128   std::size_t n = co_await my_socket.async_read_some(buffer, use_awaitable);
129   ...
130 }
131 </pre>
132 <p>
133           When used with co_await, the initiating function (<code class="computeroutput">async_read_some</code>
134           in the above example) suspends the current coroutine. The coroutine is
135           resumed when the asynchronous operation completes, and the result of the
136           operation is returned.
137         </p>
138 <h6>
139 <a name="boost_asio.reference.use_awaitable_t__executor_with_default.default_completion_token_type.h2"></a>
140           <span class="phrase"><a name="boost_asio.reference.use_awaitable_t__executor_with_default.default_completion_token_type.requirements"></a></span><a class="link" href="default_completion_token_type.html#boost_asio.reference.use_awaitable_t__executor_with_default.default_completion_token_type.requirements">Requirements</a>
141         </h6>
142 <p>
143           <span class="emphasis"><em>Header: </em></span><code class="literal">boost/asio/use_awaitable.hpp</code>
144         </p>
145 <p>
146           <span class="emphasis"><em>Convenience header: </em></span><code class="literal">boost/asio.hpp</code>
147         </p>
148 </div>
149 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
150 <td align="left"></td>
151 <td align="right"><div class="copyright-footer">Copyright &#169; 2003-2019 Christopher M. Kohlhoff<p>
152         Distributed under the Boost Software License, Version 1.0. (See accompanying
153         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>)
154       </p>
155 </div></td>
156 </tr></table>
157 <hr>
158 <div class="spirit-nav">
159 <a accesskey="p" href="../use_awaitable_t__executor_with_default.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../use_awaitable_t__executor_with_default.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="executor_with_default.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
160 </div>
161 </body>
162 </html>