Zth (libzth)
zth::Signal Class Reference

Fiber-aware signal. More...

#include <sync.h>

Inheritance diagram for zth::Signal:
zth::Synchronizer zth::RefCounted zth::UniqueID< Synchronizer > zth::UniqueIDBase

Public Member Functions

 Signal (cow_string const &name="Signal")
 
 Signal (cow_string &&name)
 
virtual ~Signal () override=default
 
void wait ()
 
bool wait (Timestamp const &timeout, Timestamp const &now=Timestamp::now())
 
bool wait (TimeInterval const &timeout, Timestamp const &now=Timestamp::now())
 
void signal (bool queue=true, bool queueEveryTime=false) noexcept
 
void signalAll (bool queue=true) noexcept
 
void reset () noexcept
 
- Public Member Functions inherited from zth::Synchronizer
 Synchronizer (cow_string const &name="Synchronizer")
 
 Synchronizer (cow_string &&name)
 
virtual ~Synchronizer () override
 
- Public Member Functions inherited from zth::RefCounted
 RefCounted () noexcept
 
virtual ~RefCounted ()=default
 
void used () noexcept
 
void unused ()
 
- Public Member Functions inherited from zth::UniqueID< Synchronizer >
 UniqueID (UniqueID const &)=delete
 
 UniqueID (UniqueID &&u) noexcept
 
 UniqueID (string const &name)
 
 UniqueID (string &&name)
 
 UniqueID (char const *name=nullptr)
 
UniqueIDoperator= (UniqueID const &)=delete
 
UniqueIDoperator= (UniqueID &&u) noexcept
 
virtual ~UniqueID ()=default
 
void const * normptr () const noexcept
 
uint64_t id () const noexcept
 
string const & name () const noexcept
 
void setName (string const &name)
 
void setName (char const *name)
 
void setName (string &&name)
 
virtual char const * id_str () const override
 

Additional Inherited Members

- Static Public Member Functions inherited from zth::UniqueID< Synchronizer >
static uint64_t getID () noexcept
 
- Protected Member Functions inherited from zth::Synchronizer
void block ()
 
bool unblock (Fiber &f) noexcept
 Unblock the specific fiber. More...
 
bool unblockFirst () noexcept
 
bool unblockAll () noexcept
 
bool block (Timestamp const &timeout, Timestamp const &now=Timestamp::now())
 Block, with timeout. More...
 
bool block (TimeInterval const &timeout, Timestamp const &now=Timestamp::now())
 Block, with timeout. More...
 
- Protected Member Functions inherited from zth::UniqueIDBase
virtual ~UniqueIDBase ()=default
 

Detailed Description

Fiber-aware signal.

Examples
daemon_pattern.cpp.

Definition at line 456 of file sync.h.

Constructor & Destructor Documentation

◆ Signal() [1/2]

zth::Signal::Signal ( cow_string const &  name = "Signal")
inlineexplicit

Definition at line 459 of file sync.h.

◆ Signal() [2/2]

zth::Signal::Signal ( cow_string &&  name)
inlineexplicit

Definition at line 465 of file sync.h.

◆ ~Signal()

virtual zth::Signal::~Signal ( )
overridevirtualdefault

Member Function Documentation

◆ reset()

void zth::Signal::reset ( )
inlinenoexcept

Definition at line 528 of file sync.h.

◆ signal()

void zth::Signal::signal ( bool  queue = true,
bool  queueEveryTime = false 
)
inlinenoexcept
Examples
daemon_pattern.cpp.

Definition at line 509 of file sync.h.

◆ signalAll()

void zth::Signal::signalAll ( bool  queue = true)
inlinenoexcept

Definition at line 520 of file sync.h.

◆ wait() [1/3]

void zth::Signal::wait ( )
inline

Definition at line 473 of file sync.h.

◆ wait() [2/3]

bool zth::Signal::wait ( TimeInterval const &  timeout,
Timestamp const &  now = Timestamp::now() 
)
inline

Definition at line 504 of file sync.h.

◆ wait() [3/3]

bool zth::Signal::wait ( Timestamp const &  timeout,
Timestamp const &  now = Timestamp::now() 
)
inline

Definition at line 488 of file sync.h.


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