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 handle
Right, unmaintainable jiggery-pokery
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.
Good! *much* more sensible! Thank you. On 5 January 2018 at 17:10, Vinnie Falco via Boost-users < boost-users@lists.boost.org> wrote:
And how would it know if the handler is a continuation?
As I understand it, you can write your own handler objects, rather than
On Fri, Jan 5, 2018 at 8:05 AM, Richard Hodges via Boost-users
wrote: 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 _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users