Epoll

public struct Epoll: FileDescriptor

Linux only. Epoll implements the Linux epoll mechanism.

  • The file descriptor for this epoll instance.

    Declaration

    Swift

    public let fileDescriptor: Int32
  • Creates an epoll instance with the specified flags.

    Declaration

    Swift

    public init(flags: Flags = []) throws
  • Adds the file descriptor to the list of FDs watched by this epoll instance. The event argument defines what event types to watch for and optional user data associated with the event.

    Declaration

    Swift

    public func add(fd: FileDescriptor, event: PollEvent) throws
  • Updates the event types and user data associated with the file descriptor for this epoll instance.

    Declaration

    Swift

    public func update(fd: FileDescriptor, event: PollEvent) throws
  • Removes the file descriptor from the list of FDs watched by this epoll instance.

    Declaration

    Swift

    public func remove(fd: FileDescriptor) throws
  • Polls for and returns available events into events, blocking as required. If a timeout is set, unblocks after this delay if no events are available. Signals may be blocked atomically by providing a SignalSet to blockedSignals. Returns the number of events available in events. No more than events.count events will be returned.

    Declaration

    Swift

    public func poll(into events: inout [PollEvent], timeout: TimeInterval? = nil, blockedSignals signals: SignalSet? = nil) throws -> Int
  • Releases the resources for this file descriptor.

    Declaration

    Swift

    public func close() throws
  • Linux only. Flags available to configure the epoll instance.

    See more

    Declaration

    Swift

    public struct Flags: OptionSet