Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Asio] defer, dispatch and post differences?
From: Richard Hodges (hodges.r_at_[hidden])
Date: 2018-01-05 16:13:15


> 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_at_[hidden]> wrote:

> On Fri, Jan 5, 2018 at 8:05 AM, Richard Hodges via Boost-users
> <boost-users_at_[hidden]> 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
> 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_at_[hidden]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net