asio C++ library

PrevUpHomeNext

Completion tokens and handlers

Initiating functions:

— are function templates with template parameter CompletionToken;

— accept, as the final parameter, a completion token object token of type CompletionToken;

— specify a completion signature, which is a call signature (C++Std [func.def]) Signature that determines the arguments to the completion handler.

An initiating function determines the type CompletionHandler of its completion handler function object by performing typename async_result<decay_t<CompletionToken>, Signature>::completion_handler_type. The completion handler object completion_handler is initialized with forward<CompletionToken>(token). [Note: No other requirements are placed on the type CompletionToken. —end note]

The type CompletionHandler must satisfy the requirements of Destructible (C++Std [destructible]) and MoveConstructible (C++Std [moveconstructible]), and be callable with the specified call signature.

In this library, all initiating functions specify a Completion signature element that defines the call signature Signature. The Completion signature elements in this Technical Specification have named parameters, and the results of an asynchronous operation are specified in terms of these names.


PrevUpHomeNext