Kanzi 4.0.0-beta2
kanzi::FlagWaiter Class Reference

Waiter object that can block the calling thread until a flag is set. More...

#include <kanzi/core/util/flag_waiter.hpp>

Public Member Functions

void clear ()
 Clear the current flag state.
 
 FlagWaiter ()=default
 Constructor.
 
 FlagWaiter (bool initialSignal)
 Constructs a FlagWaiter with a customizable initial state.
 
void signal ()
 Signal the flag and wake all waiting threads.
 
void wait ()
 Block the current thread until the flag is signaled.
 
void waitAndClear ()
 Block the current thread until the flag is signaled, and then clear the flag.
 
 ~FlagWaiter ()
 Destructor.
 

Detailed Description

Waiter object that can block the calling thread until a flag is set.

Similar in semantics to std::atomic_flag from C++ 20.

Since
Kanzi 4.0.0

Constructor & Destructor Documentation

◆ FlagWaiter() [1/2]

kanzi::FlagWaiter::FlagWaiter ( )
default

Constructor.

◆ FlagWaiter() [2/2]

kanzi::FlagWaiter::FlagWaiter ( bool initialSignal)
inlineexplicit

Constructs a FlagWaiter with a customizable initial state.

Parameters
initialSignalThe initial state of the flag.

◆ ~FlagWaiter()

kanzi::FlagWaiter::~FlagWaiter ( )
inline

Destructor.

Member Function Documentation

◆ wait()

void kanzi::FlagWaiter::wait ( )
inline

Block the current thread until the flag is signaled.

◆ clear()

void kanzi::FlagWaiter::clear ( )
inline

Clear the current flag state.

◆ waitAndClear()

void kanzi::FlagWaiter::waitAndClear ( )
inline

Block the current thread until the flag is signaled, and then clear the flag.

◆ signal()

void kanzi::FlagWaiter::signal ( )
inline

Signal the flag and wake all waiting threads.


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