Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
Backpressure

Backpressure mechanisms for controlling queue overflow and rate limiting. More...

Classes

struct  kcenon::thread::backpressure_config
 Configuration for backpressure mechanisms. More...
 
struct  kcenon::thread::backpressure_stats_snapshot
 Snapshot of backpressure statistics (copyable). More...
 
struct  kcenon::thread::backpressure_stats
 Thread-safe statistics for backpressure operations. More...
 
class  kcenon::thread::backpressure_job_queue
 A job queue with comprehensive backpressure mechanisms. More...
 
class  kcenon::thread::token_bucket
 Lock-free token bucket rate limiter for controlling throughput. More...
 

Enumerations

enum class  kcenon::thread::backpressure_policy {
  kcenon::thread::backpressure_policy::block , kcenon::thread::backpressure_policy::drop_oldest , kcenon::thread::backpressure_policy::drop_newest , kcenon::thread::backpressure_policy::callback ,
  kcenon::thread::backpressure_policy::adaptive
}
 Policy for handling queue overflow conditions. More...
 
enum class  kcenon::thread::backpressure_decision { kcenon::thread::backpressure_decision::accept , kcenon::thread::backpressure_decision::reject , kcenon::thread::backpressure_decision::drop_and_accept , kcenon::thread::backpressure_decision::delay }
 Decision returned by callback policy handler. More...
 
enum class  kcenon::thread::pressure_level { kcenon::thread::pressure_level::none , kcenon::thread::pressure_level::low , kcenon::thread::pressure_level::high , kcenon::thread::pressure_level::critical }
 Current pressure level for graduated response. More...
 

Detailed Description

Backpressure mechanisms for controlling queue overflow and rate limiting.

Enumeration Type Documentation

◆ backpressure_decision

Decision returned by callback policy handler.

When using backpressure_policy::callback, the user-provided callback function returns one of these decisions to determine how to handle the incoming job.

Enumerator
accept 

Accept the job into the queue.

reject 

Reject with error (queue_full)

drop_and_accept 

Drop the oldest job, then accept new one.

delay 

Delay processing (attempt later)

Definition at line 68 of file backpressure_config.h.

69 {
70 accept,
71 reject,
73 delay
74 };
@ drop_and_accept
Drop the oldest job, then accept new one.
@ accept
Accept the job into the queue.
@ reject
Reject with error (queue_full)
@ delay
Delay processing (attempt later)

◆ backpressure_policy

Policy for handling queue overflow conditions.

Defines how the queue should respond when it reaches capacity or encounters pressure situations.

Enumerator
block 

Block until space is available (with timeout)

drop_oldest 

Drop the oldest job when full to make room.

drop_newest 

Reject the new job when full.

callback 

Call user callback for custom decision.

adaptive 

Automatically adjust based on load conditions.

Definition at line 49 of file backpressure_config.h.

50 {
51 block,
54 callback,
56 };
@ drop_newest
Reject the new job when full.
@ block
Block until space is available (with timeout)
@ adaptive
Automatically adjust based on load conditions.
@ callback
Call user callback for custom decision.
@ drop_oldest
Drop the oldest job when full to make room.

◆ pressure_level

enum class kcenon::thread::pressure_level
strong

Current pressure level for graduated response.

Indicates the current load level of the queue based on watermark thresholds. Used by adaptive policies and for monitoring.

Enumerator
none 

Below low_watermark, queue is healthy.

low 

Between low and high watermark.

high 

Above high_watermark, approaching capacity.

critical 

At or above max_size, queue is full.

Definition at line 85 of file backpressure_config.h.

86 {
87 none,
88 low,
89 high,
91 };
@ none
Below low_watermark, queue is healthy.
@ low
Between low and high watermark.
@ critical
At or above max_size, queue is full.
@ high
Above high_watermark, approaching capacity.