• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>io_context::dispatch</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="../io_context.html" title="io_context">
9<link rel="prev" href="destroy.html" title="io_context::destroy">
10<link rel="next" href="executor_type.html" title="io_context::executor_type">
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="destroy.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../io_context.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_type.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.io_context.dispatch"></a><a class="link" href="dispatch.html" title="io_context::dispatch">io_context::dispatch</a>
28</h4></div></div></div>
29<p>
30          <a class="indexterm" name="boost_asio.indexterm.io_context.dispatch"></a>
31(Deprecated:
32          Use <a class="link" href="../dispatch.html" title="dispatch"><code class="computeroutput">dispatch</code></a>.)
33          Request the <a class="link" href="../io_context.html" title="io_context"><code class="computeroutput">io_context</code></a>
34          to invoke the given handler.
35        </p>
36<pre class="programlisting">template&lt;
37    typename <a class="link" href="../LegacyCompletionHandler.html" title="Legacy completion handler requirements">LegacyCompletionHandler</a>&gt;
38<a class="link" href="../asynchronous_operations.html#boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> dispatch(
39    LegacyCompletionHandler &amp;&amp; handler);
40</pre>
41<p>
42          This function is used to ask the <a class="link" href="../io_context.html" title="io_context"><code class="computeroutput">io_context</code></a>
43          to execute the given handler.
44        </p>
45<p>
46          The <a class="link" href="../io_context.html" title="io_context"><code class="computeroutput">io_context</code></a>
47          guarantees that the handler will only be called in a thread in which the
48          <code class="computeroutput">run()</code>, <code class="computeroutput">run_one()</code>, <code class="computeroutput">poll()</code> or <code class="computeroutput">poll_one()</code>
49          member functions is currently being invoked. The handler may be executed
50          inside this function if the guarantee can be met.
51        </p>
52<h6>
53<a name="boost_asio.reference.io_context.dispatch.h0"></a>
54          <span class="phrase"><a name="boost_asio.reference.io_context.dispatch.parameters"></a></span><a class="link" href="dispatch.html#boost_asio.reference.io_context.dispatch.parameters">Parameters</a>
55        </h6>
56<div class="variablelist">
57<p class="title"><b></b></p>
58<dl class="variablelist">
59<dt><span class="term">handler</span></dt>
60<dd>
61<p>
62                The handler to be called. The <a class="link" href="../io_context.html" title="io_context"><code class="computeroutput">io_context</code></a>
63                will make a copy of the handler object as required. The function
64                signature of the handler must be:
65</p>
66<pre class="programlisting">void handler();
67</pre>
68<p>
69              </p>
70</dd>
71</dl>
72</div>
73<h6>
74<a name="boost_asio.reference.io_context.dispatch.h1"></a>
75          <span class="phrase"><a name="boost_asio.reference.io_context.dispatch.remarks"></a></span><a class="link" href="dispatch.html#boost_asio.reference.io_context.dispatch.remarks">Remarks</a>
76        </h6>
77<p>
78          This function throws an exception only if:
79        </p>
80<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
81<li class="listitem">
82              the handler's <code class="computeroutput">asio_handler_allocate</code> function; or
83            </li>
84<li class="listitem">
85              the handler's copy constructor
86            </li>
87</ul></div>
88<p>
89          throws an exception.
90        </p>
91</div>
92<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
93<td align="left"></td>
94<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
95      Kohlhoff<p>
96        Distributed under the Boost Software License, Version 1.0. (See accompanying
97        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>)
98      </p>
99</div></td>
100</tr></table>
101<hr>
102<div class="spirit-nav">
103<a accesskey="p" href="destroy.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../io_context.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_type.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
104</div>
105</body>
106</html>
107