From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2007-08-22 07:43:45
Roland Schwarz wrote:
> I am just about to find out how I could make use of the asio library,
> and am wondering if async io also can be done without using handler
> I recognize that it is possible to use it in a blocked manner as follows:
> assuming we have an open socket: sock
> read(sock, buf);
> ... use the buffer contents ...
> Now I am wondering if I could also accomplish something like:
> cp = async_read(sock, buf);
> ... do something useful ...
> .. use the buffer contents ...
Since handlers are just function objects you can use them to do pretty
much anything, such as signalling your "cp" variable that the operation
has completed. For example, see the sample code at the bottom of this
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk