Zth (libzth)
zth::Gate Class Reference

Fiber-aware barrier/gate. More...

#include <sync.h>

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

Public Member Functions

 Gate (size_t count, cow_string const &name="Gate")
 
 Gate (size_t count, cow_string &&name)
 
virtual ~Gate () override=default
 
bool pass () noexcept
 
void wait ()
 
size_t count () const noexcept
 
size_t current () const 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 barrier/gate.

Examples
daemon_pattern.cpp.

Definition at line 757 of file sync.h.

Constructor & Destructor Documentation

◆ Gate() [1/2]

zth::Gate::Gate ( size_t  count,
cow_string const &  name = "Gate" 
)
inlineexplicit

Definition at line 760 of file sync.h.

◆ Gate() [2/2]

zth::Gate::Gate ( size_t  count,
cow_string &&  name 
)
inline

Definition at line 767 of file sync.h.

◆ ~Gate()

virtual zth::Gate::~Gate ( )
overridevirtualdefault

Member Function Documentation

◆ count()

size_t zth::Gate::count ( ) const
inlinenoexcept

Definition at line 794 of file sync.h.

◆ current()

size_t zth::Gate::current ( ) const
inlinenoexcept

Definition at line 798 of file sync.h.

◆ pass()

bool zth::Gate::pass ( )
inlinenoexcept

Definition at line 776 of file sync.h.

◆ wait()

void zth::Gate::wait ( )
inline

Definition at line 788 of file sync.h.


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