Logger System 0.1.3
High-performance C++20 thread-safe logging system with asynchronous capabilities
Loading...
Searching...
No Matches
kcenon::logger::async::compat_cv_wait Class Reference

Condition variable wait helper with stop support. More...

#include <jthread_compat.h>

Collaboration diagram for kcenon::logger::async::compat_cv_wait:
Collaboration graph

Static Public Member Functions

template<typename Lock , typename Predicate >
static bool wait (std::condition_variable &cv, Lock &lock, simple_stop_source &stop, Predicate pred)
 Wait on condition variable with stop support.
 

Detailed Description

Condition variable wait helper with stop support.

Provides a unified interface for waiting on condition variables with stop token support, regardless of jthread availability.

Definition at line 220 of file jthread_compat.h.

Member Function Documentation

◆ wait()

template<typename Lock , typename Predicate >
static bool kcenon::logger::async::compat_cv_wait::wait ( std::condition_variable & cv,
Lock & lock,
simple_stop_source & stop,
Predicate pred )
inlinestatic

Wait on condition variable with stop support.

Template Parameters
LockLock type
PredicatePredicate type
Parameters
cvCondition variable
lockLock to use
stopStop source to check
predPredicate to check
Returns
true if predicate is satisfied, false if stop was requested

Definition at line 242 of file jthread_compat.h.

245 {
246 cv.wait(lock, [&]() {
247 return stop.stop_requested() || pred();
248 });
249 return !stop.stop_requested() && pred();
250 }

References kcenon::logger::async::simple_stop_source::stop_requested().

Here is the call graph for this function:

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