Add FiberSequencer::reset#111
Open
vadimskipin wants to merge 1 commit into
Open
Conversation
Rebase the counter to an arbitrary value, up or down, under a caller- guaranteed quiescence contract: no registered waiter (asserted against the waiter tree) and no concurrent operation. advance stays monotone; reset serves callers that re-derive a baseline, like a storage recovery attempt whose durable prefix legitimately regresses.
|
Workflow [PR], commit [74575f2] Summary: ⏳
|
There was a problem hiding this comment.
Pull request overview
Adds a FiberSequencer::reset() API to explicitly rebase the sequencer counter (including decreasing it) under a caller-enforced quiescence contract, and validates the behavior with a new unit test.
Changes:
- Add
FiberSequencer::reset(uint64_t)public API and implementation to set the counter to an arbitrary value. - Add a unit test covering rebasing the counter downward and re-waiting/advancing to re-satisfy tokens.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/fibers/tests/sequencer-test.cpp |
Adds a test that rebases the counter downward and verifies wait/advance behavior afterwards. |
src/fibers/sequencer.cpp |
Implements FiberSequencer::reset() with a quiescence assertion and counter store. |
include/silk/fibers/sequencer.h |
Declares reset() and documents the intended quiescence contract. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+10
to
+14
| void FiberSequencer::reset(uint64_t value) noexcept | ||
| { | ||
| SILK_ASSERT(waiters.empty()); | ||
| counter.store(value, std::memory_order_release); | ||
| } |
Comment on lines
+129
to
+132
| /** | ||
| * Rebase the counter to @p value, up or down. The caller guarantees quiescence: no registered waiter | ||
| * and no concurrent increment / advance / wait. | ||
| */ |
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.
Rebase the counter to an arbitrary value, up or down, under a caller- guaranteed quiescence contract: no registered waiter (asserted against the waiter tree) and no concurrent operation. advance stays monotone; reset serves callers that re-derive a baseline, like a storage recovery attempt whose durable prefix legitimately regresses.