Carve FixedSizeQueue out of MpscBoundedQueue#367
Open
paulquiring wants to merge 1 commit into
Open
Conversation
paulquiring
temporarily deployed
to
workflow-approval
July 24, 2026 12:06 — with
GitHub Actions
Inactive
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //:license-checkStatus: Click to expand output |
paulquiring
commented
Jul 24, 2026
| std::condition_variable not_empty_cv_{}; | ||
| /// @brief Queue holding the elements. | ||
| FixedSizeQueue<T> queue_; | ||
| /// @brief S |
Contributor
Author
There was a problem hiding this comment.
complete comment
|
The created documentation from the pull request is available at: docu-html |
paulquiring
commented
Jul 24, 2026
| /// @brief Inserts a new element directly at the tail of the queue. | ||
| /// @tparam Args Variadic template arguments forwarded to the constructor of T. | ||
| /// @param args The arguments used to construct the object of type T. | ||
| /// @return true if the element was successfully inserted; false if the FIFO is full (overflow protection). |
Contributor
Author
There was a problem hiding this comment.
Suggested change
| /// @return true if the element was successfully inserted; false if the FIFO is full (overflow protection). | |
| /// @return true if the element was successfully inserted; false if the queue is full (overflow protection). |
WilliamRoebuck
approved these changes
Jul 24, 2026
WilliamRoebuck
left a comment
Contributor
There was a problem hiding this comment.
Looks good overall, only minor comments
| } | ||
|
|
||
| if (count_ >= Capacity) | ||
| if (!queue_.push(std::move(item))) |
Contributor
There was a problem hiding this comment.
Should be std::forward
| /// @brief Constructs a MpscBoundedQueue with a fixed runtime capacity. | ||
| /// @details If the provided size is 0, the capacity automatically falls back to 1. | ||
| /// @param size The desired maximum number of elements. | ||
| MpscBoundedQueue(size_t size) : queue_((size == 0U) ? 1U : size) { |
Contributor
There was a problem hiding this comment.
Should be explicit I think
| /// @brief Constructs a FixedSizeQueue with a fixed runtime capacity. | ||
| /// @details If the provided size is 0, the capacity automatically falls back to 1. | ||
| /// @param size The desired maximum number of elements. | ||
| FixedSizeQueue(size_t size) : capacity_((size == 0U) ? 1U : size) { |
Contributor
There was a problem hiding this comment.
Should be explicit I think
Contributor
|
Should we move this out to a separate file if it is a reusable container? |
Comment on lines
+104
to
+110
| size_t head_ = 0U; | ||
| /// @brief Index where the next element will be inserted (write index). | ||
| size_t tail_ = 0U; | ||
| /// @brief Current number of active elements in the queue. | ||
| size_t count_ = 0U; | ||
| /// @brief Maximum capacity of the queue. | ||
| size_t capacity_; |
Contributor
There was a problem hiding this comment.
These were std::size_t before, we should probably stick to that for consistency
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.
Carve FixedSizeQueue out of MpscBoundedQueue for reuse.
MpscBoundedQueues capacity can be set now at runtime, to allow
setting the capacity based on configuration.