Comments (5)
Do you need this for something specifically? Because as far as I'm aware we currently expose types for all support kinds of fds and operations supported by AFD/IOCP (as Mio uses it).
from mio.
Primarily, I'd want to be able to wait for readiness of the IOCP outside mio.
There's an idea I'm experimenting with at the moment. I have a completion IO lib that should be able to be plugged into different kinds of executors.
You have a future that issues I/O requests, and a "backend" that processes them. You have 3 options for how the backend is implemented:
- Backend itself polls the future to completion - you get a full async executor here.
- Backend works on the side as a secondary thread or a blocking task - now you possibly run into thread communication bottlenecks.
- Backend exposes a handle that can be then polled for readiness by the parent executor.
I don't have hard numbers, but 3 seems like the most effective solution. On Linux, if you have a io_uring
queue, you can plug its fd in a epoll
system, or even another io_uring
queue, and wait for multiple queues simultaneously.
I'm not so knowledgeable in windows side of things, and from what I saw, while you technically can WaitForSingleObject
on a IOCP handle, it's undocumented, unsupported, and doesn't have stable behavior, but I think you can wait for it with GetQueuedCompletionStatus
, without removing events from the queue by passing null lpOverlapped
(unless I'm misreding the docs). So I thought exposing raw handle to iocp would make sense.
from mio.
Okay, no, I'm reading more into this and this is not what I need, and exposing the handle to iocp is potentially dangerous, because the code assumes a valid pointer is an instance of Overlapped
. What I think I'd need is ability to set hEvent
of OVERLAPPED, and basically having such structure set for everything sent to IOCP.
from mio.
It might be worth it to just add an option to wait on a waitable handle to mio
.
from mio.
It might be worth it to just add an option to wait on a waitable handle to
mio
.
I don't remember the details, but if I remember correctly using the handle directly combined with the way Mio uses is quite difficult to use correctly as @h33p also found out, so I rather not add it with a good use case for it.
from mio.
Related Issues (20)
- compile time error inside `poll.rs` HOT 3
- poll: Optimize locks and allocations in the critical path
- Poll(2) implementation follow-ups
- Official ESP-IDF framework support HOT 3
- Make `CompletionPort` public? HOT 7
- No data coming from Poll HOT 8
- Difference behaves between Linux and Windows HOT 2
- How to wait for a socket to be writable? udp / Interest::READABLE | Interest::WRITABLE HOT 6
- could not compile mio due to 44 previous errors HOT 3
- WakerRegistrar mentioned in comment is not present HOT 2
- Decide MSRV for v1 HOT 2
- Use rustix instead of libc HOT 2
- Document MSRV policy HOT 1
- Update socket types API to match std lib HOT 4
- unresolved imports in target xtensa-esp32-espidf HOT 7
- `syscall!` macros hide unsafe code HOT 2
- why is it possible to create a mio TcpStream from std TcpStream but going the other way around is unsafe? HOT 13
- peek blocks after read on windows HOT 7
- Poll changing interest of server socket on Windows HOT 1
- Cannot continue listen! HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mio.