Repository navigation
Use cached write index in pop assertion - #70
Merged
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.
Summary
Use the consumer-owned cached write index in pop()'s assertion. A successful front() already acquires the producer's write index when necessary and establishes that the cached index is ahead of the item being consumed.
This isolates the assertion idea from #45. Keep the successful-front() precondition and existing wraparound/capacity logic. The assertion is compiled out under NDEBUG; no Release performance improvement is claimed.
Extend the existing POSIX Debug death test to cover a non-empty queue that has never had front() called, as well as an empty queue. This checks the missing-front diagnostic in that case, not every possible precondition violation.
Evidence
After: Debug and Release test suites pass with GCC 16.2.1, including the Debug death tests and existing concurrent FIFO/wraparound coverage.
Merge Danger
Door: two-way
Blast Radius: assertions
Valid consumer operations retain their synchronization through front(). Debug builds detect the newly covered precondition violation earlier; Release behavior is unchanged.