Repository navigation
Conversation
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.
2 of 4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TriggerFduses a Unix domain socketpair. QNX pipes go through a single-threaded pipe service.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 reportsPOLLOUT.Test plan
bazelisk test //toolbelt:triggerfd_teston macOS, which builds the pipe path. 1/1 passed.