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

Policy that rejects new item when queue is full (same as reject) More...

#include <overflow_policies.h>

Collaboration diagram for kcenon::thread::policies::overflow_drop_newest_policy:
Collaboration graph

Public Types

using policy_tag = overflow_policy_tag
 

Public Member Functions

auto handle_overflow (std::unique_ptr< job > &&) -> common::VoidResult
 Handle overflow by dropping the new item silently.
 

Static Public Member Functions

static constexpr auto blocks () noexcept -> bool
 Check if this policy blocks on overflow.
 
static constexpr auto drops_newest () noexcept -> bool
 Check if this policy drops items on overflow.
 
static constexpr auto name () noexcept -> const char *
 Get a descriptive name for this policy.
 

Detailed Description

Policy that rejects new item when queue is full (same as reject)

When the queue is full, the new item is dropped instead of being added. This is semantically equivalent to overflow_reject_policy but with different naming convention for clarity in some contexts.

Use Cases

  • Burst handling where excess items should be silently dropped
  • Scenarios where existing work is more important than new work
  • Simple overflow handling without error propagation
Note
Unlike overflow_reject_policy, this policy returns success even though the item was dropped.

Definition at line 207 of file overflow_policies.h.

Member Typedef Documentation

◆ policy_tag

Member Function Documentation

◆ blocks()

static constexpr auto kcenon::thread::policies::overflow_drop_newest_policy::blocks ( ) -> bool
inlinestaticnodiscardconstexprnoexcept

Check if this policy blocks on overflow.

Returns
false (never blocks)

Definition at line 226 of file overflow_policies.h.

226 {
227 return false;
228 }

◆ drops_newest()

static constexpr auto kcenon::thread::policies::overflow_drop_newest_policy::drops_newest ( ) -> bool
inlinestaticnodiscardconstexprnoexcept

Check if this policy drops items on overflow.

Returns
true (drops newest)

Definition at line 234 of file overflow_policies.h.

234 {
235 return true;
236 }

◆ handle_overflow()

auto kcenon::thread::policies::overflow_drop_newest_policy::handle_overflow ( std::unique_ptr< job > && ) -> common::VoidResult
inlinenodiscard

Handle overflow by dropping the new item silently.

Parameters
valueThe job that would be added (will be dropped)
Returns
Success (item was handled, by dropping)

Definition at line 216 of file overflow_policies.h.

217 {
218 // Silently drop the item
219 return common::ok();
220 }

◆ name()

static constexpr auto kcenon::thread::policies::overflow_drop_newest_policy::name ( ) -> const char*
inlinestaticnodiscardconstexprnoexcept

Get a descriptive name for this policy.

Returns
Policy name string

Definition at line 242 of file overflow_policies.h.

242 {
243 return "overflow_drop_newest";
244 }

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