Skip to content

Conversation

@FranzBusch
Copy link
Member

Motivation

To observe events on file descriptors IO_URING supports the pollAdd operation. This is useful when you want to observe a file descriptor becoming ready to read or write

Modifications

This PR adds a new IORing.Request.PollEvents option set to model the poll masks. Furthermore, it adds a new static func pollAdd to the IORing.Request.

Result

We can now use IO_URING to poll for events on file descriptors.

@FranzBusch
Copy link
Member Author

@swift-ci please test

@FranzBusch FranzBusch force-pushed the fb-io-uring-poll-add branch 2 times, most recently from c64fc9c to e69d5c1 Compare December 8, 2025 11:05
@FranzBusch
Copy link
Member Author

@swift-ci please test

Copy link
Member

@Catfish-Man Catfish-Man left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a few comments but I don't think any of them are necessarily blockers

///
/// - ``PollEvents``: The events that can be monitored.
/// - ``IORing/Request/cancel(_:matching:)``: Cancelling poll operations.
@inlinable public static func pollAdd(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically Swift naming style would be verb-first but if there's a good reason to have it this way it's probably fine

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to match what the io_uring operation was called. I wasn't sure how much we tried to change the naming to fit our Swift naming guidelines.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guessed that was probably what you were doing. I remember this coming up during the initial proposal review and iirc folks leaned "don't try to make the names friendlier" so that looking up docs will work better. I'm still torn on it but I see the logic.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know what you prefer and I am happy to change if needed. I am open to both.

## Motivation

To observe events on file descriptors IO_URING supports the `pollAdd` operation. This is useful when you want to observe a file descriptor becoming ready to read or write

## Modifications

This PR adds a new `IORing.Request.PollEvents` option set to model the poll masks. Furthermore, it adds a new `static func pollAdd` to the `IORing.Request`.

## Result

We can now use IO_URING to poll for events on file descriptors.
@FranzBusch
Copy link
Member Author

@swift-ci please test

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.

3 participants