Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. — Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

io_context::dispatch
PrevUpHomeNext

(Deprecated: Use dispatch.) Request the io_context to invoke the given handler.

template<
    typename LegacyCompletionHandler>
DEDUCED dispatch(
    LegacyCompletionHandler && handler);

This function is used to ask the io_context to execute the given handler.

The io_context guarantees that the handler will only be called in a thread in which the run(), run_one(), poll() or poll_one() member functions is currently being invoked. The handler may be executed inside this function if the guarantee can be met.

Parameters

handler

The handler to be called. The io_context will make a copy of the handler object as required. The function signature of the handler must be:

void handler();

Remarks

This function throws an exception only if:

  • the handler's asio_handler_allocate function; or
  • the handler's copy constructor

throws an exception.


PrevUpHomeNext