Commit Graph

31 Commits

Author SHA1 Message Date
Nikolay Arhipov 9e46c8455c
feat: ported to Vita target
Fixes #160
2024-04-20 11:22:46 -07:00
John Nunley b9ab821df1
bugfix: Handle interrupts while polling
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>
2023-10-27 07:02:08 -07:00
John Nunley 9e143a38e1
bugfix: Manage sources being inserted into kqueue
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>
2023-09-27 21:30:46 -07:00
John Nunley c7cc91a1f1
docs: Specify behavior when registered in multiple pollers
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>
2023-08-16 09:48:14 -07:00
John Nunley a521cd2c29
breaking: Extract the Events struct and make the Event struct opaque
* 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>
2023-08-14 10:03:20 -07:00
John Nunley c6a0890627
feat: Add support for waiting on waitable handles
* 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>
2023-08-08 20:40:21 -07:00
John Nunley 6eb7679aa3
breaking: Rework the API for I/O safety
* Rework the API for I/O safety

* Bump to rustix v0.38
2023-08-03 20:15:59 -07:00
John Nunley 75cff30584
feat: Add functionality for posting events to the IOCP (#101) 2023-04-16 07:37:48 -07:00
John Nunley 0f38ed35ea
Add edge/oneshot combination mode (#96) 2023-03-25 15:22:45 +01:00
John Nunley f48f2c1a5a
test: Add test for more than 32 connections (#93)
Making sure that this works on Windows after #88
2023-03-08 10:40:23 -08:00
John Nunley 24900fb662
m(windows): Reimplement Wepoll in Rust (#88)
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.
2023-03-05 16:25:25 -08:00
Taiki Endo 900b00c061 Test NetBSD/OpenBSD/Dragonfly BSD with vmactions 2023-01-23 00:15:00 +09:00
John Nunley 181acc67d0
Add level and edge triggered modes to the poller (#59)
* Add level and edge triggered modes to the poller

* Refractor error handling

* Add tests for new modes
2022-12-30 14:43:47 -08:00
Taiki Endo bc56d1fb38
Test the backend that uses poll on CI (#63) 2022-12-29 16:01:25 +09:00
Taiki Endo 5e9bedbae8 Sort target_os cfg to match docs 2022-12-28 12:24:56 +09:00
John Nunley 97e6ecd0d0
Support tvOS and watchOS (#60) 2022-12-19 19:54:45 -08:00
Taiki Endo dec94cb423 Clean up CI config 2022-01-09 01:50:42 +09:00
Kestrer 597b6aed86 Add concurrent modification tests 2021-09-04 19:19:02 +01:00
Koxiaet 2fc0831d40 Use poll on VxWorks, Fuchsia and other Unix systems 2020-12-17 18:56:48 +00:00
Mike Zeller 6f778cddf1 port_dissociate should be aware of ENOENT 2020-10-19 22:19:12 +00:00
Stjepan Glavina bf546cb173 Fix warnings 2020-08-15 09:12:45 +02:00
Stjepan Glavina 8f1c4e530d Set timeout to 0 when non-blocking epoll_wait 2020-08-15 09:05:58 +02:00
Stjepan Glavina 7a1d7386ba Set interest after configuring timerfd 2020-08-15 08:31:00 +02:00
Stjepan Glavina 49cdfb8d5a Add notify tests 2020-08-15 08:23:45 +02:00
Stjepan Glavina cd0c0925c7 Loop 2020-08-15 08:18:12 +02:00
Stjepan Glavina 453d2b2d5e Add test 2020-08-15 08:16:22 +02:00
Stjepan Glavina f1f3d4609c Another try on windows 2020-08-14 15:18:44 +02:00
Stjepan Glavina 984a005589 Disable precision tests on windows 2020-08-14 15:08:27 +02:00
Stjepan Glavina 11f77ff54b Some polish 2020-08-14 14:38:02 +02:00
Stjepan Glavina 74edf79d78 Run precision tests on windows 2020-08-14 14:32:23 +02:00
Stjepan Glavina c6818f038f Sub-nanosecond precision for epoll 2020-08-14 13:46:58 +02:00