Skip to content

Register each file descriptor once with epoll / kqueue#314

Open
iCharlesHu wants to merge 1 commit into
swiftlang:mainfrom
iCharlesHu:charles/efficient-io
Open

Register each file descriptor once with epoll / kqueue#314
iCharlesHu wants to merge 1 commit into
swiftlang:mainfrom
iCharlesHu:charles/efficient-io

Conversation

@iCharlesHu

Copy link
Copy Markdown
Contributor

Persistently register each descriptor with epoll/kqueue and reuse it across reads and writes, detaching only on EOF, error, cancellation, or close:

  • Switch epoll/kqueue to edge-triggered (EPOLLET / EV_CLEAR).
  • Make read()/write() attempt the non-blocking syscall first and await a readiness signal only on EAGAIN.
  • Detach in _safelyClose on Unix, mirroring Windows.

@iCharlesHu iCharlesHu requested a review from jakepetroules June 12, 2026 19:56
Persistently register each descriptor with epoll/kqueue and reuse it across reads and writes, detaching only on EOF, error, cancellation, or close:

- Switch epoll/kqueue to edge-triggered (EPOLLET / EV_CLEAR).
- Make read()/write() attempt the non-blocking syscall first and await a readiness signal only on EAGAIN.
- Detach in _safelyClose on Unix, mirroring Windows.
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