-
Notifications
You must be signed in to change notification settings - Fork 70
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
feat: Add functionality for posting events to the IOCP #101
Conversation
ok idk I probably can't accurately test this; I have no direct access to any windows machine, and even if I could I currently don't have time to bother to freshly setup rust and get stuff to work there... code-wise, I count this as "should be good enough". LGTM. might just lack in testing. |
I added some tests to make sure it all works. |
.post(CompletionPacket::new(Event::writable(i))) | ||
.unwrap(); | ||
|
||
thread::sleep(Duration::from_millis(100)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the timing of stuff here looks odd...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did this to make sure that, even if the main thread handles the first packet, it will fall asleep before handling the second one. This way we can be sure that a completion packet wakes up the thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. (failed tests are network timeouts on githubs intranet)
Adds a
CompletionPacket
structure that can be used to post arbitrary events to the I/O completion port. The idea is to allow for self-wakeups without using pipes, which aren't available on Windows.