• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>thread_pool::add_service</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="../thread_pool.html" title="thread_pool">
9<link rel="prev" href="../thread_pool.html" title="thread_pool">
10<link rel="next" href="attach.html" title="thread_pool::attach">
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="../thread_pool.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../thread_pool.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="attach.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.thread_pool.add_service"></a><a class="link" href="add_service.html" title="thread_pool::add_service">thread_pool::add_service</a>
28</h4></div></div></div>
29<p>
30          <span class="emphasis"><em>Inherited from execution_context.</em></span>
31        </p>
32<p>
33          <a class="indexterm" name="boost_asio.indexterm.thread_pool.add_service"></a>
34(Deprecated:
35          Use <code class="computeroutput">make_service()</code>.) Add a service object to the <a class="link" href="../execution_context.html" title="execution_context"><code class="computeroutput">execution_context</code></a>.
36        </p>
37<pre class="programlisting">template&lt;
38    typename <a class="link" href="../Service.html" title="Service requirements">Service</a>&gt;
39friend void add_service(
40    execution_context &amp; e,
41    Service * svc);
42</pre>
43<p>
44          This function is used to add a service to the <a class="link" href="../execution_context.html" title="execution_context"><code class="computeroutput">execution_context</code></a>.
45        </p>
46<h6>
47<a name="boost_asio.reference.thread_pool.add_service.h0"></a>
48          <span class="phrase"><a name="boost_asio.reference.thread_pool.add_service.parameters"></a></span><a class="link" href="add_service.html#boost_asio.reference.thread_pool.add_service.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">e</span></dt>
54<dd><p>
55                The <a class="link" href="../execution_context.html" title="execution_context"><code class="computeroutput">execution_context</code></a>
56                object that owns the service.
57              </p></dd>
58<dt><span class="term">svc</span></dt>
59<dd>
60<p>
61                The service object. On success, ownership of the service object is
62                transferred to the <a class="link" href="../execution_context.html" title="execution_context"><code class="computeroutput">execution_context</code></a>.
63                When the <a class="link" href="../execution_context.html" title="execution_context"><code class="computeroutput">execution_context</code></a>
64                object is destroyed, it will destroy the service object by performing:
65</p>
66<pre class="programlisting">delete static_cast&lt;execution_context::service*&gt;(svc)
67</pre>
68<p>
69              </p>
70</dd>
71</dl>
72</div>
73<h6>
74<a name="boost_asio.reference.thread_pool.add_service.h1"></a>
75          <span class="phrase"><a name="boost_asio.reference.thread_pool.add_service.exceptions"></a></span><a class="link" href="add_service.html#boost_asio.reference.thread_pool.add_service.exceptions">Exceptions</a>
76        </h6>
77<div class="variablelist">
78<p class="title"><b></b></p>
79<dl class="variablelist">
80<dt><span class="term">boost::asio::service_already_exists</span></dt>
81<dd><p>
82                Thrown if a service of the given type is already present in the
83                <a class="link" href="../execution_context.html" title="execution_context"><code class="computeroutput">execution_context</code></a>.
84              </p></dd>
85<dt><span class="term">boost::asio::invalid_service_owner</span></dt>
86<dd><p>
87                Thrown if the service's owning <a class="link" href="../execution_context.html" title="execution_context"><code class="computeroutput">execution_context</code></a>
88                is not the <a class="link" href="../execution_context.html" title="execution_context"><code class="computeroutput">execution_context</code></a>
89                object specified by the <code class="computeroutput">e</code> parameter.
90              </p></dd>
91</dl>
92</div>
93<h6>
94<a name="boost_asio.reference.thread_pool.add_service.h2"></a>
95          <span class="phrase"><a name="boost_asio.reference.thread_pool.add_service.requirements"></a></span><a class="link" href="add_service.html#boost_asio.reference.thread_pool.add_service.requirements">Requirements</a>
96        </h6>
97<p>
98          <span class="emphasis"><em>Header: </em></span><code class="literal">boost/asio/thread_pool.hpp</code>
99        </p>
100<p>
101          <span class="emphasis"><em>Convenience header: </em></span><code class="literal">boost/asio.hpp</code>
102        </p>
103</div>
104<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
105<td align="left"></td>
106<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
107      Kohlhoff<p>
108        Distributed under the Boost Software License, Version 1.0. (See accompanying
109        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>)
110      </p>
111</div></td>
112</tr></table>
113<hr>
114<div class="spirit-nav">
115<a accesskey="p" href="../thread_pool.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../thread_pool.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="attach.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
116</div>
117</body>
118</html>
119