
On Wed, Jul 11, 2012 at 12:05 PM, Ovanes Markarian
On Wed, Jul 11, 2012 at 5:10 PM, Nat Linden
wrote:
When you want code that appears to block, but is actually driven by asynchronous I/O, that's a use case for Boost.Coroutine. Interestingly, the new Coroutine is supposed to be reviewed very soon: http://olk.bplaced.net/boost-coroutine.zip
Nat thanks for the quick reply... But what happens with the tcp::iostream if another thread starts to read from it after a connection was open, but no response is there? Would not it block? Is it even safe to write requests to the tcp::iostream from one thread and read it from the other? As I stated before, I would like to solve the issue with ASIO only. I might be able to review coroutine lib, but I don't think this an option for us in this project.
coroutine != thread. :-) A coroutine is user-space context switching, and it happens at well-defined times. It's just a way of organizing code that must otherwise be structured to receive intermittent calls -- as with an ASIO completion handler.