Skip to content

Use a socketpair for TriggerFd only on QNX - #32

Open
dallison wants to merge 2 commits into
mainfrom
qnx_pipes
Open

dallison wants to merge 2 commits into
mainfrom
qnx_pipes

Conversation

@dallison

@dallison dallison commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • On QNX, TriggerFd uses a Unix domain socketpair. QNX pipes go through a single-threaded pipe service.
  • Linux stays on eventfd. macOS and other POSIX systems stay on a pipe. A socketpair was slower than a pipe on macOS, especially when a publish wakes another thread, and a socketpair read end always reports POLLOUT.

Test plan

  • bazelisk test //toolbelt:triggerfd_test on macOS, which builds the pipe path. 1/1 passed.
  • QNX build of the socketpair path.

TriggerFd used a pipe on every platform without eventfd. On QNX, pipes
are served by the single-threaded pipe resource manager, which makes
them slow under load. A socketpair is pollable, nonblocking, and can be
passed over SCM_RIGHTS, so it is a drop-in replacement for the pipe on
macOS, QNX, and other POSIX systems. Linux keeps using eventfd.

Add triggerfd_test covering create, trigger/clear, repeated triggers,
non-blocking behaviour when the buffer is full, and move semantics.
QNX pipes go through a single-threaded pipe service. On macOS a socketpair was slower than a pipe, especially when a publish wakes another thread, and its read end always reports POLLOUT. Linux stays on eventfd and other POSIX systems stay on a pipe.
@dallison dallison changed the title Use a Unix domain socketpair for TriggerFd on non-Linux POSIX Use a socketpair for TriggerFd only on QNX Nov 15, 2026
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