Skip to content

Handle Duration overflow gracefully in kevent.#1427

Merged
sunfishcode merged 1 commit into
mainfrom
sunfishcode/kqueue-timeout
Apr 1, 2025
Merged

Handle Duration overflow gracefully in kevent.#1427
sunfishcode merged 1 commit into
mainfrom
sunfishcode/kqueue-timeout

Conversation

@sunfishcode

Copy link
Copy Markdown
Member

Add a kevent_timespec function, which is similar to kevent, but which takes a Timespec rather than a Duration, so that it can behave consistently with the other functions in rustix::event. This also more closely reflects how the underlying kevent function takes a timespec argument.

And, change the existing kevent to treat overflow in its Duration argument by saturating to an effectively infinite timeout. This supports users that use Duration::MAX to indicate an effectively infinite timeout.

Add a `kevent_timespec` function, which is similar to `kevent`, but
which takes a `Timespec` rather than a `Duration`, so that it can behave
consistently with the other functions in `rustix::event`. This also
more closely reflects how the underlying `kevent` function takes a
`timespec` argument.

And, change the existing `kevent` to treat overflow in its `Duration`
argument by saturating to an effectively infinite timeout. This supports
users that use `Duration::MAX` to indicate an effectively infinite
timeout.
@sunfishcode
sunfishcode merged commit 416b4c3 into main Apr 1, 2025
@sunfishcode
sunfishcode deleted the sunfishcode/kqueue-timeout branch April 12, 2025 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant