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

Simple stop source for environments without std::stop_token. More...

#include <jthread_compat.h>

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

Public Member Functions

 simple_stop_source ()
 
void request_stop ()
 Request stop.
 
bool stop_requested () const noexcept
 Check if stop was requested.
 
void reset ()
 Reset stop state (for reuse)
 

Private Attributes

std::atomic< bool > stopped_
 

Detailed Description

Simple stop source for environments without std::stop_token.

Provides a minimal implementation of stop signaling mechanism using atomic flags and condition variables.

Definition at line 48 of file jthread_compat.h.

Constructor & Destructor Documentation

◆ simple_stop_source()

kcenon::logger::async::simple_stop_source::simple_stop_source ( )
inline

Definition at line 50 of file jthread_compat.h.

50: stopped_(false) {}

Member Function Documentation

◆ request_stop()

void kcenon::logger::async::simple_stop_source::request_stop ( )
inline

Request stop.

Definition at line 55 of file jthread_compat.h.

55 {
56 stopped_.store(true, std::memory_order_release);
57 }

References stopped_.

◆ reset()

void kcenon::logger::async::simple_stop_source::reset ( )
inline

Reset stop state (for reuse)

Definition at line 69 of file jthread_compat.h.

69 {
70 stopped_.store(false, std::memory_order_release);
71 }

References stopped_.

◆ stop_requested()

bool kcenon::logger::async::simple_stop_source::stop_requested ( ) const
inlinenodiscardnoexcept

Check if stop was requested.

Definition at line 62 of file jthread_compat.h.

62 {
63 return stopped_.load(std::memory_order_acquire);
64 }

References stopped_.

Referenced by kcenon::logger::async::compat_cv_wait::wait().

Here is the caller graph for this function:

Member Data Documentation

◆ stopped_

std::atomic<bool> kcenon::logger::async::simple_stop_source::stopped_
private

Definition at line 74 of file jthread_compat.h.

Referenced by request_stop(), reset(), and stop_requested().


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