3 ms·
This sounds similar to what we have in Nim right now. There are multiple layers (from highest to lowest): * Async await * The async dispatcher (event loop) *
by dom96 10y ago
This sounds similar to what we have in Nim right now. There are multiple layers (from highest to lowest):
* Async await
* The async dispatcher (event loop)
* Selectors module
Each builds on top of the layers below it. The selectors module is an abstraction for the various system `select()` mechanism such as epoll or kqueue. If you wish you can use it directly, and some people have done so successfully[1]. But you must be aware that on Windows it only supports `select()`.
The async dispatcher implements the proactor pattern and also has an implementation of IOCP. It implements the proactor pattern for other OS' via the selectors module. Futures are also implemented here, and indeed all the procedures return a future.
The final layer is the async await transformation. This allows you to write asynchronous code in a synchronous style and works similar to C#'s await. The transformation works by converting any async procedures into an iterator.
This is also single threaded and fully non-blocking and does give you a lot of control. In theory you should be able to work with any of these layers interchangeably (as long as you only care about non-Windows platforms).
1 - http://goran.krampe.se/2014/10/25/nim-socketserver/ http://goran.krampe.se/2014/10/25/nim-socketserver/
- steveklabnik 10y agoYeah we map the IOCP model to a readiness one, so it's totally platform independent. Wonder if you all could do the same.
- dom96 10y agoI believe we already do the same thing. As I've said, we use the proactor pattern and map it onto the readiness one.