Skip to content

Carve FixedSizeQueue out of MpscBoundedQueue#367

Open
paulquiring wants to merge 1 commit into
eclipse-score:mainfrom
etas-contrib:feature/carve-FixedSizeQueue-out-of-MpscBoundedQueue
Open

Carve FixedSizeQueue out of MpscBoundedQueue#367
paulquiring wants to merge 1 commit into
eclipse-score:mainfrom
etas-contrib:feature/carve-FixedSizeQueue-out-of-MpscBoundedQueue

Conversation

@paulquiring

@paulquiring paulquiring commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Carve FixedSizeQueue out of MpscBoundedQueue for reuse.
MpscBoundedQueues capacity can be set now at runtime, to allow
setting the capacity based on configuration.

@github-actions

Copy link
Copy Markdown

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run --lockfile_mode=error //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.6.0) and connecting to it...
INFO: Invocation ID: 9e4ea9b6-1b95-4343-b998-1c7ad204d808
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)

Analyzing: target //:license-check (36 packages loaded, 10 targets configured)

Analyzing: target //:license-check (86 packages loaded, 10 targets configured)

Analyzing: target //:license-check (131 packages loaded, 248 targets configured)

Analyzing: target //:license-check (151 packages loaded, 3083 targets configured)

Analyzing: target //:license-check (156 packages loaded, 5498 targets configured)

Analyzing: target //:license-check (161 packages loaded, 5547 targets configured)

Analyzing: target //:license-check (161 packages loaded, 5547 targets configured)

Analyzing: target //:license-check (162 packages loaded, 5547 targets configured)

Analyzing: target //:license-check (164 packages loaded, 7434 targets configured)

Analyzing: target //:license-check (167 packages loaded, 10275 targets configured)

Analyzing: target //:license-check (168 packages loaded, 10283 targets configured)

Analyzing: target //:license-check (168 packages loaded, 10283 targets configured)

Analyzing: target //:license-check (168 packages loaded, 10283 targets configured)

INFO: Analyzed target //:license-check (169 packages loaded, 10409 targets configured).
[11 / 16] Creating runfiles tree bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/score_tooling+/dash/tool/formatters/dash_format_converter.runfiles [for tool]; 0s local
[14 / 16] JavaToolchainCompileBootClasspath external/rules_java+/toolchains/platformclasspath.jar; 0s disk-cache, processwrapper-sandbox
[15 / 16] Building license.check.license_check.jar (); 0s disk-cache, multiplex-worker
INFO: Found 1 target...
Target //:license.check.license_check up-to-date:
  bazel-bin/license.check.license_check
  bazel-bin/license.check.license_check.jar
INFO: Elapsed time: 27.756s, Critical Path: 2.31s
INFO: 16 processes: 12 internal, 3 processwrapper-sandbox, 1 worker.
INFO: Build completed successfully, 16 total actions
INFO: Running command line: bazel-bin/license.check.license_check ./formatted.txt <args omitted>
usage: org.eclipse.dash.licenses.cli.Main [-batch <int>] [-cd <url>]
       [-confidence <int>] [-ef <url>] [-excludeSources <sources>] [-help] [-lic
       <url>] [-project <shortname>] [-repo <url>] [-review] [-summary <file>]
       [-timeout <seconds>] [-token <token>]

std::condition_variable not_empty_cv_{};
/// @brief Queue holding the elements.
FixedSizeQueue<T> queue_;
/// @brief S

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

complete comment

@github-actions

Copy link
Copy Markdown

The created documentation from the pull request is available at: docu-html

/// @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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 WilliamRoebuck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, only minor comments

}

if (count_ >= Capacity)
if (!queue_.push(std::move(item)))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be explicit I think

@NicolasFussberger

Copy link
Copy Markdown
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_;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were std::size_t before, we should probably stick to that for consistency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants