On Fri, Jan 5, 2018 at 8:05 AM, Richard Hodges via Boost-users
And how would it know if the handler is a continuation?
As I understand it, you can write your own handler objects, rather than than simply passing in a lambda or bind, which get notified either: 1. once on completion of the entire request, or 2. for every sub-operation of a compound operation such as async_read()
asio figures out which one you mean through some template jiggery-pokery (technical term) and your handler gets called the right number of times, on the right thread.
I don't think that is correct. Pre Net-TS, Asio considered a handler to be a continuation if the function asio_handler_is_continuation returned `true` when passed a pointer to an instance of that handler type. The new Asio does not use this mechanism. Instead, it requires that the caller use post() if the handler is not a continuation and defer() if it is. So the caller informs the implementation whether or not the handler is a continuation, just like before but by invoking the correct function. However, it is not clear how to accomplish that. Which is why an example would be helpful. Thanks