Zth (libzth)
Loading...
Searching...
No Matches
zth::SynchronizerBase Class Referenceabstract

#include <sync.h>

Inheritance diagram for zth::SynchronizerBase:
zth::RefCounted zth::UniqueID< SynchronizerBase > zth::NamedUniqueID< Named > zth::UniqueIDBase zth::Synchronizer< 2 > zth::Synchronizer< Size > zth::Mailbox< T > zth::Future< return_type > zth::Future< T > zth::Future< void > zth::Gate zth::Mutex zth::Semaphore zth::Signal

Classes

class  AlarmClock
 

Public Member Functions

virtual ~SynchronizerBase () noexcept override
 
- Public Member Functions inherited from zth::RefCounted
 RefCounted () noexcept
 
virtual ~RefCounted () noexcept
 
void used () noexcept
 
bool unused () noexcept
 
size_t refs () const noexcept
 
- Public Member Functions inherited from zth::UniqueID< SynchronizerBase >
 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 () noexcept override=default
 
void const * normptr () const noexcept
 
uint64_t id () const noexcept
 
- Public Member Functions inherited from zth::NamedUniqueID< Named >
virtual ~NamedUniqueID () noexcept override=default
 
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 noexcept override
 

Protected Types

typedef List queue_type
 

Protected Member Functions

 SynchronizerBase (cow_string const &name="Synchronizer")
 
 SynchronizerBase (cow_string &&name)
 
virtual queue_typequeue (size_t q=0)=0
 
queue_type::iterator enqueue (Listable &item, size_t q=0) noexcept
 
void block (size_t q=0)
 
bool unblock (Fiber &f, size_t q=0, bool prio=false) noexcept
 Unblock the specific fiber.
 
ListableunblockFirst (size_t q=0, bool prio=false) noexcept
 
bool unblockAll (size_t q=0, bool prio=false) noexcept
 
virtual void wakeup (Listable &item, queue_type::user_type user, bool prio, size_t q) noexcept
 
bool blockUntil (Timestamp const &timeout, Timestamp const &now=Timestamp::now(), size_t q=0)
 Block, with timeout.
 
bool blockFor (TimeInterval const &timeout, Timestamp const &now=Timestamp::now(), size_t q=0)
 Block, with timeout.
 
- Protected Member Functions inherited from zth::RefCounted
virtual void cleanup () noexcept
 
- Protected Member Functions inherited from zth::UniqueID< SynchronizerBase >
virtual uint64_t id_ () const noexcept final
 
- Protected Member Functions inherited from zth::NamedUniqueID< Named >
 NamedUniqueID (char const *name=nullptr)
 
 NamedUniqueID (string const &name)
 
 NamedUniqueID (string &&name)
 
- Protected Member Functions inherited from zth::UniqueIDBase
virtual ~UniqueIDBase () noexcept=default
 

Friends

class AlarmClock
 

Additional Inherited Members

- Public Types inherited from zth::UniqueID< SynchronizerBase >
typedef NamedUniqueID base
 
- Static Public Member Functions inherited from zth::UniqueID< SynchronizerBase >
static uint64_t getID () noexcept
 

Detailed Description

Definition at line 272 of file sync.h.

Member Typedef Documentation

◆ queue_type

Definition at line 292 of file sync.h.

Constructor & Destructor Documentation

◆ SynchronizerBase() [1/2]

zth::SynchronizerBase::SynchronizerBase ( cow_string const &  name = "Synchronizer")
inlineexplicitprotected

Definition at line 275 of file sync.h.

◆ SynchronizerBase() [2/2]

zth::SynchronizerBase::SynchronizerBase ( cow_string &&  name)
inlineexplicitprotected

Definition at line 280 of file sync.h.

◆ ~SynchronizerBase()

virtual zth::SynchronizerBase::~SynchronizerBase ( )
inlineoverridevirtualnoexcept

Definition at line 286 of file sync.h.

Member Function Documentation

◆ block()

void zth::SynchronizerBase::block ( size_t  q = 0)
inlineprotected

Definition at line 301 of file sync.h.

◆ blockFor()

bool zth::SynchronizerBase::blockFor ( TimeInterval const &  timeout,
Timestamp const &  now = Timestamp::now(),
size_t  q = 0 
)
inlineprotected

Block, with timeout.

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

Definition at line 429 of file sync.h.

◆ blockUntil()

bool zth::SynchronizerBase::blockUntil ( Timestamp const &  timeout,
Timestamp const &  now = Timestamp::now(),
size_t  q = 0 
)
inlineprotected

Block, with timeout.

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

Definition at line 415 of file sync.h.

◆ enqueue()

queue_type::iterator zth::SynchronizerBase::enqueue ( Listable item,
size_t  q = 0 
)
inlineprotectednoexcept

Definition at line 296 of file sync.h.

◆ queue()

virtual queue_type & zth::SynchronizerBase::queue ( size_t  q = 0)
protectedpure virtual

◆ unblock()

bool zth::SynchronizerBase::unblock ( Fiber f,
size_t  q = 0,
bool  prio = false 
)
inlineprotectednoexcept

Unblock the specific fiber.

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

Definition at line 319 of file sync.h.

◆ unblockAll()

bool zth::SynchronizerBase::unblockAll ( size_t  q = 0,
bool  prio = false 
)
inlineprotectednoexcept

Definition at line 340 of file sync.h.

◆ unblockFirst()

Listable * zth::SynchronizerBase::unblockFirst ( size_t  q = 0,
bool  prio = false 
)
inlineprotectednoexcept

Definition at line 329 of file sync.h.

◆ wakeup()

virtual void zth::SynchronizerBase::wakeup ( Listable item,
queue_type::user_type  user,
bool  prio,
size_t  q 
)
inlineprotectedvirtualnoexcept

Reimplemented in zth::Mailbox< T >.

Definition at line 354 of file sync.h.

Friends And Related Symbol Documentation

◆ AlarmClock

friend class AlarmClock
friend

Definition at line 408 of file sync.h.


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