On 1/11/2016 21:41, Niall Douglas wrote:
You also don't need to use completion ports like ASIO does for async i/o on Windows which are slightly complex to use. There is a much simpler solution called alertable i/o which AFIO v2 uses which has NT dispatch for you all pending async i/o callbacks every time you sleep a thread. Examine AFIO v2's source code for ideas if you like, you can throw together an async pipe i/o multiplexed reactor with very little effort in no time because NT has already implemented an "ASIO" for you, no ASIO needed.
Having written my own mostly-lock-free ASIO-lite based around completion ports, I can confirm that they're not at all complex to use. Meanwhile I shy away from alertable I/O because it's thread-affine and requires remembering to always perform alertable waits, both of which seem fragile to me. Still, the advantage of both methods existing is that you can use whatever you feel most comfortable with. :)