boost asio note 2 – asynchronous agent

Table of Contents

file

An asynchronous agent is a sequential composition of asynchronous operations. Every asynchronous operation is considered to run as a part of an asynchronous agent, even if that agent contains only that single operation. An asynchronous agent is an entity that may perform work concurrently with other agents. Asynchronous agents are to asynchronous operations as threads are to synchronous operations.

异步代理是异步操作的顺序组合。 每个异步操作都被视为作为异步代理的一部分运行,即使该代理仅包含该单个操作也是如此。 异步代理是可以与其他代理同时执行工作的实体。 异步代理之于异步操作就像线程之于同步操作一样。

However, an asynchronous agent is a purely notional construct that allows us to reason about the context for, and composition of, asynchronous operations in a program. The name “asynchronous agent” does not appear in the library, nor is it important which concrete mechanism[1] is used to compose the asynchronous operations in an agent.

然而,异步代理是一个纯粹的概念性结构,它允许我们推断程序中异步操作的上下文和组合。 “异步代理”这个名字没有出现在库中,使用哪种具体机制来组成代理中的异步操作也不重要。

可以形象地以下图描述异步代理

file

Asynchronous agents alternately wait for an asynchronous operation to complete, and then run a completion handler for that operation. Within the context of an agent, these completion handlers represent indivisible units of schedulable work.

异步代理交替等待异步操作完成,然后运行该操作的完成处理程序。 在代理的上下文中,这些完成处理程序代表不可分割的可调度工作单元。

Comments |0|

Legend *) Required fields are marked
**) You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
Category: boost | 程序人生