11 Jul
2014
11 Jul
'14
2:47 p.m.
On Tue, Jul 8, 2014 at 10:34 AM, pfultz2
Ideally, it would be nice if there were facades that would make an async stream -> sync stream, and a sync stream -> async stream.
For such flexibility, you're better off to make all fundamental I/O operations async. ASIO already has adapters that can block until any of its async I/O operation completes. Moreover, you can provide different adapters to block at varying levels of granularity: block the whole thread, block the calling fiber, block a coroutine. But how could you adapt a synchronous operation to be async? Your code will not regain control until the synchronous operation has completed. You have no chance to do anything clever in the meantime.