Changeset 84314

Timestamp:
May 17, 2013, 3:07:51 AM (9 years ago)
Author:
chris_kohlhoff
Message:

Add a new handler hook called asio_handler_is_continuation.

Asynchronous operations may represent a continuation of the asynchronous
control flow associated with the current handler. Asio's implementation
can use this knowledge to optimise scheduling of the handler.

The asio_handler_is_continuation hook returns true to indicate whether a
completion handler represents a continuation of the current call
context. The default implementation of the hook returns false, and
applications may customise the hook when necessary. The hook has already
been customised within Asio to return true for the following cases:

  • Handlers returned by strand.wrap(), when the corresponding asynchronous operation is being initiated from within the strand.
  • The internal handlers used to implement the asio::spawn() function's stackful coroutines.
  • When an intermediate handler of a composed operation (e.g. asio::async_read(), asio::async_write(), asio::async_connect(), ssl::stream<>, etc.) starts a new asynchronous operation due to the composed operation not being complete.

To support this optimisation, a new running_in_this_thread() member
function has been added to the io_service::strand class. This function
returns true when called from within a strand.

(No files)

Note: See TracChangeset for help on using the changeset viewer.