Insane_DNS/libraries/asio-1.28.1/doc/asio/overview/model/child_agents.html

109 lines
5.6 KiB
HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Child Agents</title>
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../../../index.html" title="Asio">
<link rel="up" href="../model.html" title="Asynchronous Model">
<link rel="prev" href="associators.html" title="Associated Characteristics and Associators">
<link rel="next" href="executors.html" title="Executors">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="associators.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../model.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="executors.html"><img src="../../../next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="asio.overview.model.child_agents"></a><a class="link" href="child_agents.html" title="Child Agents">Child Agents</a>
</h4></div></div></div>
<p>
The asynchronous operations within an agent may themselves be implemented
in terms of child agents.<sup>[<a name="asio.overview.model.child_agents.f0" href="#ftn.asio.overview.model.child_agents.f0" class="footnote">3</a>]</sup> As far as the parent agent is concerned, it is waiting for
the completion of a single asynchronous operation. The asynchronous operations
that constitute the child agent run in sequence, and when the final completion
handler runs the parent agent is resumed.
</p>
<p>
<span class="inlinemediaobject"><img src="../../../async_child_agent_chain.png" width="802"></span>
</p>
<p>
As with individual asynchronous operations, the asynchronous operations
built on child agents must release their temporary resources prior to calling
the completion handler. We may also think of these child agents as resources
that end their lifetimes before the completion handler is invoked.
</p>
<p>
When an asynchronous operation creates a child agent, it may propagate<sup>[<a name="asio.overview.model.child_agents.f1" href="#ftn.asio.overview.model.child_agents.f1" class="footnote">4</a>]</sup> the associated characteristics of the parent agent to the child
agent. These associated characteristics may then be recursively propagated
through further layers of asynchronous operations and child agents. This
stacking of asynchronous operations replicates another property of synchronous
operations.
</p>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Property of synchronous operations
</p>
</th>
<th>
<p>
Equivalent property of asynchronous operations
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
Compositions of synchronous operations may be refactored to use
child functions that run on the same thread (i.e. are simply
called) without altering functionality.
</p>
</td>
<td>
<p>
Asynchronous agents may be refactored to use asynchronous operations
and child agents that share the associated characteristics of
the parent agent, without altering functionality.
</p>
</td>
</tr></tbody>
</table></div>
<p>
Finally, some asynchronous operations may be implemented in terms of multiple
child agents that run concurrently. In this case, the asynchronous operation
may choose to selectively propagate the associated characteristics of the
parent agent.
</p>
<div class="footnotes">
<br><hr width="100" align="left">
<div class="footnote"><p><sup>[<a name="ftn.asio.overview.model.child_agents.f0" href="#asio.overview.model.child_agents.f0" class="para">3</a>] </sup>
In Asio these asynchronous operations are referred to as <span class="emphasis"><em>composed
operations</em></span>.
</p></div>
<div class="footnote"><p><sup>[<a name="ftn.asio.overview.model.child_agents.f1" href="#asio.overview.model.child_agents.f1" class="para">4</a>] </sup>
Typically, by specialising the associator trait and forwarding to the
outer completion handler.
</p></div>
</div>
</div>
<div class="copyright-footer">Copyright © 2003-2023 Christopher M. Kohlhoff<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="associators.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../model.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="executors.html"><img src="../../../next.png" alt="Next"></a>
</div>
</body>
</html>