-
Notifications
You must be signed in to change notification settings - Fork 198
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
Add cancellation #105
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It appears all the Go implementations of serial drivers are not asynchronous. This is fine, because in Go you can use goroutine to wait on blocked code. However, cancellation would be expected, but it's not available. Currently, the only way to cancel a Read or Write is to close the serial port, which cancels every operation, rather than the specific operation you want cancelled.
Regarding cancellation on Windows:
This is important in Go, because goroutines are scheduled across multiple threads usually, and there is no guarantee which thread a piece of code is currently running on.
This implies that providing the overlapped structure cancels only that I/O operation.
The Unix implementation can be added to easily, since it's already "select"ing over the port handle and a cancellation handle used only when closing the port.
Timeouts would also be possible through system calls, but that is a less ideal, because Go can easily do timeouts on its own. So I think adding cancellation satisfies any need for setting timeouts.
The text was updated successfully, but these errors were encountered: