Loading…
|
Translation changed |
|
|
String added in the repository |
|
Loading…
|
Translation changed |
|
|
String added in the repository |
|
Asynchronous operations are started by calling a free function or member function known as an asynchronous ['__async_initfn__]. This function accepts parameters specific to the operation as well as a __CompletionToken__. The token is either a completion handler, or a type defining how the caller is informed of the asynchronous operation result. Networking provides the special tokens异步操作通过调用一个自由函数或成员函数来启动,该函数被称为异步[发起函数]。发起函数接收操作相关的参数以及一个 __CompletionToken__ 完成令牌。该令牌可以是一个完成处理器,也可以是一种用于定义调用方如何获知异步操作结果的方式。网络库提供 __use_future__and和 __yield_context__for using futures and coroutines respectively. This system of customizing the return value and method of completion notification is known as the ['Universal Asynchronous Model] described in __N3747__, and a built in to __NetTS__. Here is an example of an initiating function which reads a line from the stream and echoes it back. This function is developed further in the next section:这两种特殊令牌,分别用于支持 future 和协程。这种自定义返回值及完成通知方式的机制被称为 __N3747__ 中描述的通用异步模型,并已内置到 __NetTS__ 中。以下是一个发起函数的示例,该函数用于从流中读取一行数据并将其回显回去。下一节将进一步开发此函数: