From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2005-12-12 18:58:10
--- Felipe Magno de Almeida <felipe.m.almeida_at_[hidden]> wrote:
> You think every functor should be executed exactly-once for correct
> program design?
> Wouldnt this still be safe?
> class handler
> void fail(asio::error err)
> // handle the error case, and probably delete this handle, or
> reuse it for retrying
> void success(int size)
> // do something, or continue reading or delete this
> // member variables
> async_read(s, buffers,
> boost::bind(boost::mem_fn(&handler::success), this)
> , boost::bind(boost::mem_fn(&handler::fail), this)
Of course, you're right, and there's nothing unsafe with the above.
Somehow I had the idea that you wanted to share the same error handler
between multiple asynchronous operations as the default behaviour.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk