• 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::strand::wrap</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__strand.html" title="io_context::strand">
9<link rel="prev" href="strand.html" title="io_context::strand::strand">
10<link rel="next" href="_strand.html" title="io_context::strand::~strand">
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="strand.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../io_context__strand.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="_strand.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__strand.wrap"></a><a class="link" href="wrap.html" title="io_context::strand::wrap">io_context::strand::wrap</a>
28</h4></div></div></div>
29<p>
30          <a class="indexterm" name="boost_asio.indexterm.io_context__strand.wrap"></a>
31(Deprecated:
32          Use <a class="link" href="../bind_executor.html" title="bind_executor"><code class="computeroutput">bind_executor</code></a>.)
33          Create a new handler that automatically dispatches the wrapped handler
34          on the strand.
35        </p>
36<pre class="programlisting">template&lt;
37    typename <a class="link" href="../Handler.html" title="Handlers">Handler</a>&gt;
38unspecified wrap(
39    Handler handler);
40</pre>
41<p>
42          This function is used to create a new handler function object that, when
43          invoked, will automatically pass the wrapped handler to the strand's dispatch
44          function.
45        </p>
46<h6>
47<a name="boost_asio.reference.io_context__strand.wrap.h0"></a>
48          <span class="phrase"><a name="boost_asio.reference.io_context__strand.wrap.parameters"></a></span><a class="link" href="wrap.html#boost_asio.reference.io_context__strand.wrap.parameters">Parameters</a>
49        </h6>
50<div class="variablelist">
51<p class="title"><b></b></p>
52<dl class="variablelist">
53<dt><span class="term">handler</span></dt>
54<dd>
55<p>
56                The handler to be wrapped. The strand will make a copy of the handler
57                object as required. The function signature of the handler must be:
58</p>
59<pre class="programlisting">void handler(A1 a1, ... An an);
60</pre>
61<p>
62              </p>
63</dd>
64</dl>
65</div>
66<h6>
67<a name="boost_asio.reference.io_context__strand.wrap.h1"></a>
68          <span class="phrase"><a name="boost_asio.reference.io_context__strand.wrap.return_value"></a></span><a class="link" href="wrap.html#boost_asio.reference.io_context__strand.wrap.return_value">Return
69          Value</a>
70        </h6>
71<p>
72          A function object that, when invoked, passes the wrapped handler to the
73          strand's dispatch function. Given a function object with the signature:
74        </p>
75<pre class="programlisting">R f(A1 a1, ... An an);
76</pre>
77<p>
78          If this function object is passed to the wrap function like so:
79        </p>
80<pre class="programlisting">strand.wrap(f);
81</pre>
82<p>
83          then the return value is a function object with the signature
84        </p>
85<pre class="programlisting">void g(A1 a1, ... An an);
86</pre>
87<p>
88          that, when invoked, executes code equivalent to:
89        </p>
90<pre class="programlisting">strand.dispatch(boost::bind(f, a1, ... an));
91</pre>
92</div>
93<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
94<td align="left"></td>
95<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
96      Kohlhoff<p>
97        Distributed under the Boost Software License, Version 1.0. (See accompanying
98        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>)
99      </p>
100</div></td>
101</tr></table>
102<hr>
103<div class="spirit-nav">
104<a accesskey="p" href="strand.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../io_context__strand.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="_strand.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
105</div>
106</body>
107</html>
108