Previous, `Poller::wait` would bubble signal interruption error to the user.
However, this may be unexpected for simple use cases. Thus, this commit makes
it so, if `ErrorKind::Interrupted` is received by the underlying `wait()` call,
it clears the events and tries to wait again.
This also adds a test for this interruption written by @psychon.
Co-Authored-By: Uli Schlachter <psychon@users.noreply.github.com>
Signed-off-by: John Nunley <dev@notgull.net>
Thus far, our kqueue implementation has been a relatively thin layer on
top of the OS kqueue. However, kqueue doesn't keep track of when the
same source is inserted twice, or when a source that doesn't exist is
removed. In the interest of keeping consistent behavior between backends
this commit adds a system for tracking when sources are inserted.
Closes#151
Signed-off-by: John Nunley <dev@notgull.net>
This adds documentation to add() describing what happens when a source
is registered in multiple pollers. A test is also added to ensure this
behavior.
Signed-off-by: John Nunley <dev@notgull.net>
* Add better documentation for the IOCP module
* Extract Events from Poller
This prevents the need to have an intermediate buffer to read events
from, reducing the need for an allocation and a copy. This is a breaking
change.
* Add event extra information
Foundation for more details later on.
* Add PRI and HUP events
* Fix various failing tests
- Make sure that waitable handles interact properly with the new
infrastructure
- Fix failing doctests
* Review comments
- Make set_* take a boolean for the value of the flag
- Make Events !Sync
- Fix visibility modifiers
- Inline more methods
- Use a better strategy for testing
* Move completion packets into the Events buffer
This removes one of the mutexes that we have to lock.
* Review comments
Signed-off-by: John Nunley <dev@notgull.net>
* Add support for polling waitable handles
* Add a smoke test
* Fix failing tests
* Rebase on latest master
Signed-off-by: John Nunley <dev@notgull.net>
* Update semantics for new system
Signed-off-by: John Nunley <dev@notgull.net>
* Forgot about doctests
Signed-off-by: John Nunley <dev@notgull.net>
---------
Signed-off-by: John Nunley <dev@notgull.net>
Reimplements the C-based wepoll backend in Rust, using some handwritten code. This PR also implements bindings to the I/O Completion Ports and \Device\Afd APIs. For more information on the latter, see my blog post on the subject: https://notgull.github.io/device-afd/
Note that the IOCP API is wrapped using a `Pin`-oriented "CompletionHandle" system that is relatively brittle. This should be replaced with a better model when one becomes available.