Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
kcenon::thread::queue_capabilities Struct Reference

Runtime-queryable queue capabilities descriptor. More...

#include <queue_capabilities.h>

Collaboration diagram for kcenon::thread::queue_capabilities:
Collaboration graph

Public Member Functions

constexpr auto operator== (const queue_capabilities &other) const noexcept -> bool=default
 Equality comparison operator.
 

Public Attributes

bool exact_size = true
 size() returns exact value (vs approximate for lock-free queues)
 
bool atomic_empty_check = true
 empty() check is atomic and consistent
 
bool lock_free = false
 Implementation uses lock-free algorithms.
 
bool wait_free = false
 Implementation uses wait-free algorithms (stronger than lock-free)
 
bool supports_batch = true
 Supports batch enqueue/dequeue operations.
 
bool supports_blocking_wait = true
 Supports blocking dequeue with wait.
 
bool supports_stop = true
 Supports stop() method to signal shutdown.
 

Detailed Description

Runtime-queryable queue capabilities descriptor.

This struct provides a standardized way to describe the capabilities of different queue implementations at runtime. It enables code to adapt its behavior based on the underlying queue's characteristics.

Default Values

All fields have sensible defaults matching mutex-based job_queue behavior, ensuring backward compatibility when adding this capability to existing queues.

Usage Example

auto caps = queue->get_capabilities();
if (caps.exact_size) {
// Safe to use size() for precise decisions
auto count = queue->size();
}
if (caps.lock_free) {
// Can expect better performance under high contention
}
Examples
queue_capabilities_sample.cpp.

Definition at line 40 of file queue_capabilities.h.

Member Function Documentation

◆ operator==()

auto kcenon::thread::queue_capabilities::operator== ( const queue_capabilities & other) const -> bool=default
nodiscardconstexprdefaultnoexcept

Equality comparison operator.

Parameters
otherAnother queue_capabilities to compare
Returns
true if all capabilities match

Member Data Documentation

◆ atomic_empty_check

bool kcenon::thread::queue_capabilities::atomic_empty_check = true

empty() check is atomic and consistent

Definition at line 45 of file queue_capabilities.h.

◆ exact_size

bool kcenon::thread::queue_capabilities::exact_size = true

size() returns exact value (vs approximate for lock-free queues)

Definition at line 42 of file queue_capabilities.h.

◆ lock_free

bool kcenon::thread::queue_capabilities::lock_free = false

Implementation uses lock-free algorithms.

Definition at line 48 of file queue_capabilities.h.

◆ supports_batch

bool kcenon::thread::queue_capabilities::supports_batch = true

Supports batch enqueue/dequeue operations.

Definition at line 54 of file queue_capabilities.h.

◆ supports_blocking_wait

bool kcenon::thread::queue_capabilities::supports_blocking_wait = true

Supports blocking dequeue with wait.

Definition at line 57 of file queue_capabilities.h.

◆ supports_stop

bool kcenon::thread::queue_capabilities::supports_stop = true

Supports stop() method to signal shutdown.

Definition at line 60 of file queue_capabilities.h.

◆ wait_free

bool kcenon::thread::queue_capabilities::wait_free = false

Implementation uses wait-free algorithms (stronger than lock-free)

Definition at line 51 of file queue_capabilities.h.


The documentation for this struct was generated from the following file: