
On Fri, Jul 25, 2008 at 2:44 PM, Mathias Gaunard <mathias.gaunard@ens-lyon.org> 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