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>
Once upon a time, this got a Vec as an argument, but that was replaced
with the Events struct. Thus, this should link to Events and not Vec.
Signed-off-by: Uli Schlachter <psychon@znc.in>
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>
Added in 272bb11eaf for reasons that are
unclear to me. It serves no purpose aside from disabling the API of the
entire crate, so it's best to remove it.
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>
In some containers, eventfd is not available as it cannot be implemented
securely in some hosts. This commit adds a fallback notifier that uses
a pipe instead of eventfd.
Closes#122
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>
This means that we only depend on rustix, so all of the system calls
are direct. This should make mustang integration trivial.
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>
* Support for the ESP-IDF framework
* Restore the spans to work with the raw notify fd
* On Linux eventfd needs PollFlags::IN
* Add cargo check for ESP IDF to the CI
---------
Co-authored-by: imarkov <imarkov@vmware.com>
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.
Dragonfly BSD 6.4.0 VM doesn't seem to have git.
```
error: failed to get `cfg-if` as a dependency of package `polling v2.5.2 (/Users/runner/work/polling/polling)`
Caused by:
failed to load source for dependency `cfg-if`
Caused by:
Unable to update registry `crates-io`
Caused by:
failed to fetch `https://github.com/rust-lang/crates.io-index`
Caused by:
could not execute process `git fetch --force --update-head-ok 'https://github.com/rust-lang/crates.io-index' '+HEAD:refs/remotes/origin/HEAD'` (never executed)
Caused by:
No such file or directory (os error 2)
```