Boost logo

Boost :

From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2008-07-25 09:27:37


On Fri, Jul 25, 2008 at 2:44 PM, Mathias Gaunard
<mathias.gaunard_at_[hidden]> wrote:
> atkinson julian wrote:
>> Hi, the combination of asio and coroutines would seem to represent a little
>> bit of magic (layering a linear code model over an async event framework and
>> without the attendant issues involved in multithreading).
>
> Yes, it would be pretty cool.
> However, couldn't the syntax be directly that of blocking asio calls?
>
> coro::future<error_type, iterator_type> future(self);
> resolver.async_resolve(query, coro::make_callback(future));
> coro::wait(future);
>
> is really the same thing as
>
> tuple<error_type, iterator_type> result = resolver.resolve(query);
>

Yes, it is. The point is that you can have many coroutines in flight
at the same time. With the blocking call variant you must have
multiple threads to do the same thing.

Julian: sorry for not replying, I'm far from a compilable
boost.coroutine installation ATM and cannot test your code (and
probably I won't be for two weeks). BTW, yes, the example in the doc
is wrong and your code should Just work; if it doesn't it is a bug in
the library.

-- 
gpd

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