Boost logo

Boost :

From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2005-12-12 16:17:00


Hi Felipe,

--- Felipe Magno de Almeida <felipe.m.almeida_at_[hidden]> wrote:
<snip>

> I think that one possible solution would be that error checks
> would be than by the asio, and redirect it to another function
> if an error is found. That way could be binded two functions.
> It even seems to be possible to create auxiliary classes that
> does this things on top of the current asio library. It would
> even make the code a lot clearer, comparing to both .NET and
> current asio usage.

This could be done by composing a new function object to be
passed as the handler, e.g.:

  async_read(s, buffers,
    combine_handlers(handler1, handler2));

Boost.Lambda may also be of some use here.

However I am not convinced that this approach would be widely
applicable. There are many cases in networking where an error
for an individual operation is not an error for the application.

I also see the current "exactly-once" semantics of invoking
handlers as important in aiding correct program design, so I'd
be wary of using anything that changed that.

Cheers,
Chris


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk