-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need an interface to plug asynchronous Windows Handle types for serial ports #3396
Comments
This is something we do want to do. I imagine we can add an |
Thanks, we'd be happy to help with this feature and iterate the API until we have something that everyone is happy with. I don't have enough context to understand why |
The guards help make sure that the ready flag is cleared correctly when using |
Adding AsyncHandle would be non trivial due to how IOCP works. It looks like the serial lib really only needs names pipes on windows? We should focus on getting a named pipe type in tokio. |
For context, named pipes are being worked on in #3388. |
Why is that? |
My understanding is that it's because IOCP isn't based on readiness like kqueue or epoll, and is instead built around an operation itself being async and posting a completion when it finishes. This means it would need to have a very different API than, say, AsyncFd. I think that this is still doable though. |
Is your feature request related to a problem? Please describe.
In Tokio 0.2, PollEvented was used in tokio-serial to make serial ports work asynchronously with Tokio.
Tokio 0.3/1.0 have removed all the mio types, and exposed only a unix-specifix
AsyncFd
type. So serial ports can be integrated asynchrnously on Linux, but not windows.Describe the solution you'd like
I'd like to see a parallel API to
AsyncFd
which is Windows-only allowing a windowsHandle
type to be registered.To register a handle, I personally only need a single public method:
Describe alternatives you've considered
I've considered running serial ports synchronously, after all there aren't 10K of them, but we are writing protocol libraries for SCADA systems using Tokio where the same protocol is used over TCP or serial. Our codebase uses generic fucntionality based on
AsyncRead
+AsyncWrite
so this not tenable for us because our entire protocol stack is async.I've also considered having my Windows serial port implementation fake async by delegating blocking operations to a dedicated thread, but this is not optimal in the long run.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: