Add bounded timer waits and cancellation callbacks - #4
Merged
Conversation
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.
Return-and-resume handlers can now wait on timers without keeping worker threads occupied. Opt-in cancellation callbacks release retained application state after abandoned flushes and waits.
Context.wait(delay_ns),.timer, and opt-in.cancelledcallbacks..finishor.close; those actions never trigger an extra callback.The timer uses a fresh monotonic timestamp. Existing polling can delay wakeups. This interface does not provide dynamic output leases. Application state and locals remain ineligible for output borrowing.
Exact candidate
6f6af03e828159455b91cece6ba468201651e1f6passed native verification with Zig 0.16.0. Debug and ReleaseSafe each completed all 16 build steps.Linux/macOS native run and Windows native run passed. Windows also passed nine shard cases and the 30,000-response correctness smoke gate. Documentation and offline whitepaper checks passed locally.
Fixtures cover 32 waiters sharing one worker, depth-128 pipelines, partial sends, one-slot reuse, and shutdown. Deterministic tests cover terminal-result races, queued cancellation, stale clocks, and frozen batches. The first Windows attempt exposed an omitted socket-error class in the test retry; the final candidate includes that correction. No Zig source changed for that correction. No performance tests were run.