• 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::run (2 of 2 overloads)</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="../run.html" title="io_context::run">
9<link rel="prev" href="overload1.html" title="io_context::run (1 of 2 overloads)">
10<link rel="next" href="../run_for.html" title="io_context::run_for">
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="overload1.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../run.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="../run_for.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h5 class="title">
27<a name="boost_asio.reference.io_context.run.overload2"></a><a class="link" href="overload2.html" title="io_context::run (2 of 2 overloads)">io_context::run
28          (2 of 2 overloads)</a>
29</h5></div></div></div>
30<p>
31            (Deprecated: Use non-error_code overload.) Run the <a class="link" href="../../io_context.html" title="io_context"><code class="computeroutput">io_context</code></a>
32            object's event processing loop.
33          </p>
34<pre class="programlisting">count_type run(
35    boost::system::error_code &amp; ec);
36</pre>
37<p>
38            The <code class="computeroutput">run()</code> function blocks until all work has finished and
39            there are no more handlers to be dispatched, or until the <a class="link" href="../../io_context.html" title="io_context"><code class="computeroutput">io_context</code></a>
40            has been stopped.
41          </p>
42<p>
43            Multiple threads may call the <code class="computeroutput">run()</code> function to set up a
44            pool of threads from which the <a class="link" href="../../io_context.html" title="io_context"><code class="computeroutput">io_context</code></a>
45            may execute handlers. All threads that are waiting in the pool are equivalent
46            and the <a class="link" href="../../io_context.html" title="io_context"><code class="computeroutput">io_context</code></a>
47            may choose any one of them to invoke a handler.
48          </p>
49<p>
50            A normal exit from the <code class="computeroutput">run()</code> function implies that the
51            <a class="link" href="../../io_context.html" title="io_context"><code class="computeroutput">io_context</code></a>
52            object is stopped (the <code class="computeroutput">stopped()</code> function returns <code class="computeroutput">true</code>).
53            Subsequent calls to <code class="computeroutput">run()</code>, <code class="computeroutput">run_one()</code>, <code class="computeroutput">poll()</code>
54            or <code class="computeroutput">poll_one()</code> will return immediately unless there is a
55            prior call to <code class="computeroutput">restart()</code>.
56          </p>
57<h6>
58<a name="boost_asio.reference.io_context.run.overload2.h0"></a>
59            <span class="phrase"><a name="boost_asio.reference.io_context.run.overload2.parameters"></a></span><a class="link" href="overload2.html#boost_asio.reference.io_context.run.overload2.parameters">Parameters</a>
60          </h6>
61<div class="variablelist">
62<p class="title"><b></b></p>
63<dl class="variablelist">
64<dt><span class="term">ec</span></dt>
65<dd><p>
66                  Set to indicate what error occurred, if any.
67                </p></dd>
68</dl>
69</div>
70<h6>
71<a name="boost_asio.reference.io_context.run.overload2.h1"></a>
72            <span class="phrase"><a name="boost_asio.reference.io_context.run.overload2.return_value"></a></span><a class="link" href="overload2.html#boost_asio.reference.io_context.run.overload2.return_value">Return
73            Value</a>
74          </h6>
75<p>
76            The number of handlers that were executed.
77          </p>
78<h6>
79<a name="boost_asio.reference.io_context.run.overload2.h2"></a>
80            <span class="phrase"><a name="boost_asio.reference.io_context.run.overload2.remarks"></a></span><a class="link" href="overload2.html#boost_asio.reference.io_context.run.overload2.remarks">Remarks</a>
81          </h6>
82<p>
83            Calling the <code class="computeroutput">run()</code> function from a thread that is currently
84            calling one of <code class="computeroutput">run()</code>, <code class="computeroutput">run_one()</code>, <code class="computeroutput">run_for()</code>,
85            <code class="computeroutput">run_until()</code>, <code class="computeroutput">poll()</code> or <code class="computeroutput">poll_one()</code>
86            on the same <a class="link" href="../../io_context.html" title="io_context"><code class="computeroutput">io_context</code></a>
87            object may introduce the potential for deadlock. It is the caller's reponsibility
88            to avoid this.
89          </p>
90<p>
91            The <code class="computeroutput">poll()</code> function may also be used to dispatch ready handlers,
92            but without blocking.
93          </p>
94</div>
95<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
96<td align="left"></td>
97<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
98      Kohlhoff<p>
99        Distributed under the Boost Software License, Version 1.0. (See accompanying
100        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>)
101      </p>
102</div></td>
103</tr></table>
104<hr>
105<div class="spirit-nav">
106<a accesskey="p" href="overload1.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../run.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="../run_for.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
107</div>
108</body>
109</html>
110