Skip to content

perf(concurrent): drop 25ms poll, block on Signals::forever() - #2538

Merged
max-sixty merged 1 commit into
mainfrom
poll-fix
May 3, 2026
Merged

max-sixty merged 1 commit into
mainfrom
poll-fix

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Follow-up to #2537. output/concurrent.rs::spawn_signal_forwarder was running the same kind of pending() + 25 ms sleep ticker that #2537 removed from Cmd::stream. Replace it with the same event-driven shape: the listener thread blocks on Signals::forever(), and SignalForwarder::stop() closes the signal-hook handle to unblock it before joining.

Drops the Arc<AtomicBool> stop flag — the signal-hook handle now serves both shutdown signaling and signal delivery. Two-press SIGKILL semantics (impatient escalation on the second SIGINT) are preserved via the local seen_once flag in the listener.

Latency under Ctrl-C improves from "up to 25 ms after the press" to "as soon as signal-hook delivers the signal" — most useful for the second SIGINT in the kill-all path. test_alias_concurrent_second_sigint_kills still completes within its 3 s budget.

This was written by Claude Code on behalf of @max-sixty

`spawn_signal_forwarder` was running a `pending()` + `sleep(25ms)`
ticker, mirroring the `Cmd::stream` polling loop just removed in
#2537. Replace with the same shape: the listener thread blocks on
`Signals::forever()`, and `SignalForwarder::stop()` closes the
signal-hook handle to unblock it before joining.

Drops the `Arc<AtomicBool>` stop flag — the handle now serves both
shutdown signaling and signal delivery. Two-press SIGKILL semantics
(impatient escalation on the second SIGINT) are preserved via the
local `seen_once` flag.

Latency under Ctrl-C improves from "up to 25 ms after the press" to
"as soon as signal-hook delivers the signal" — most useful for the
second SIGINT in the kill-all path. The existing
test_alias_concurrent_second_sigint_kills test still completes
within its 3 s budget.

Co-Authored-By: Claude <noreply@anthropic.com>
@max-sixty
max-sixty merged commit 6656d77 into main May 3, 2026
30 checks passed
@max-sixty
max-sixty deleted the poll-fix branch May 3, 2026 01:32
@max-sixty max-sixty mentioned this pull request May 3, 2026
max-sixty added a commit that referenced this pull request May 3, 2026
Cuts v0.47.0. Highlights:

- **Integration detection fix** across `wt list`, `wt remove`, `wt
merge`, `wt step prune` for the local/upstream-diverged case (#2507,
#2513, #2515).
- **Faster shell-command dispatch** (~10ms per invocation, 1.49× on
trivial aliases) via event-driven signal forwarding (#2537, #2538), plus
parallel config load (#2543) and merged cold-start prewarm rev-parse
(#2541).
- **`wt switch <number>` suggests `pr:N` / `mr:N`** instead of just
`--create` (#2516).
- **Library API breaking changes**: `RefSnapshot` cutover (#2528, #2530)
and the `for-each` direct-exec change (#2465). Full list in
`CHANGELOG.md`.

See `CHANGELOG.md` for the complete entry.

> _This was written by Claude Code on behalf of @max-sixty_

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants