Zth (libzth)
zth::Synchronizer Class Reference

#include <sync.h>

Inheritance diagram for zth::Synchronizer:
zth::RefCounted zth::UniqueID< Synchronizer > zth::UniqueIDBase zth::Future< T > zth::Future< void > zth::Gate zth::Mutex zth::Semaphore zth::Signal

Classes

class  AlarmClock
 

Public Member Functions

 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
 

Protected Member Functions

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
 

Friends

class AlarmClock
 

Additional Inherited Members

- Static Public Member Functions inherited from zth::UniqueID< Synchronizer >
static uint64_t getID () noexcept
 

Detailed Description

Definition at line 153 of file sync.h.

Constructor & Destructor Documentation

◆ Synchronizer() [1/2]

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

Definition at line 158 of file sync.h.

◆ Synchronizer() [2/2]

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

Definition at line 164 of file sync.h.

◆ ~Synchronizer()

virtual zth::Synchronizer::~Synchronizer ( )
inlineoverridevirtual

Definition at line 170 of file sync.h.

Member Function Documentation

◆ block() [1/3]

void zth::Synchronizer::block ( )
inlineprotected

Definition at line 177 of file sync.h.

◆ block() [2/3]

bool zth::Synchronizer::block ( TimeInterval const &  timeout,
Timestamp const &  now = Timestamp::now() 
)
inlineprotected

Block, with timeout.

Returns
true if unblocked by request, false when unblocked by timeout.

Definition at line 299 of file sync.h.

◆ block() [3/3]

bool zth::Synchronizer::block ( Timestamp const &  timeout,
Timestamp const &  now = Timestamp::now() 
)
inlineprotected

Block, with timeout.

Returns
true if unblocked by request, false when unblocked by timeout.

Definition at line 286 of file sync.h.

◆ unblock()

bool zth::Synchronizer::unblock ( Fiber f)
inlineprotectednoexcept

Unblock the specific fiber.

Returns
true if unblocked, false when not queued by this Synchronizer.

Definition at line 194 of file sync.h.

◆ unblockAll()

bool zth::Synchronizer::unblockAll ( )
inlineprotectednoexcept

Definition at line 225 of file sync.h.

◆ unblockFirst()

bool zth::Synchronizer::unblockFirst ( )
inlineprotectednoexcept

Definition at line 209 of file sync.h.

Friends And Related Function Documentation

◆ AlarmClock

friend class AlarmClock
friend

Definition at line 280 of file sync.h.


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