`IORing` now supports `pollAdd`

Hi System enthusiasts,

IORing now supports the pollAdd operation for observing events on a FileDescriptor. Thank you to @FranzBusch, @glessard, and @MarSe32m for the contributions! [IO_URING] Add support for `pollAdd` operation by FranzBusch · Pull Request #273 · apple/swift-system · GitHub

New API on main:

struct IORing.Request.PollEvents: OptionSet, Hashable, Codable {
  init(rawValue: UInt32)
  static var readable     // 0x0001
  static var priorityData // 0x0002
  static var writable     // 0x0004
  static var error        // 0x0008
  static var hangUp       // 0x0010
  static var invalidDescriptor // 0x0020
  static var peerClosed   // 0x2000
}

extension IORing.Request {
  static func pollAdd(
    _ file: FileDescriptor,
    events: PollEvents,
    isMultiShot: Bool = false,
    context: UInt64 = 0
  ) -> IORing.Request
}

See the PR for doc comments and usage examples. Please try it out on main and send your feedback here on the forums or as an issue on GitHub. These changes will be included in the next minor release of swift-system.

Thank you!

1 Like