Zth (libzth)
Loading...
Searching...
No Matches
zth::coro::Mailbox< T > Class Template Reference

#include <coro.h>

Inheritance diagram for zth::coro::Mailbox< T >:
zth::Mailbox< T > zth::Synchronizer< 2 > zth::SynchronizerBase zth::RefCounted zth::UniqueID< SynchronizerBase > zth::NamedUniqueID< Named > zth::UniqueIDBase

Public Types

using base = zth::Mailbox< T >
 
using type = typename base::type
 
- Public Types inherited from zth::Mailbox< T >
typedef T type
 
typedef void * assigned_type
 
- Public Types inherited from zth::Synchronizer< 2 >
typedef SynchronizerBase base
 
- Public Types inherited from zth::UniqueID< SynchronizerBase >
typedef NamedUniqueID base
 

Public Member Functions

 Mailbox (promise_base &owner, cow_string const &name="coro::Mailbox")
 
virtual ~Mailbox () noexcept override=default
 
promise_baseowner () const noexcept
 
std::coroutine_handle waiter () const noexcept
 
bool valid (std::coroutine_handle<> waiter) const noexcept
 
void wait (Listable &item, std::coroutine_handle<> waiter) noexcept
 
type take (std::coroutine_handle<> waiter)
 
void abandon ()
 
bool abandoned () const noexcept
 
bool valid () const noexcept
 
bool valid (assigned_type assigned) const noexcept
 
void wait ()
 
virtual void wait (assigned_type assigned)
 
type take ()
 
type take (assigned_type assigned)
 
- Public Member Functions inherited from zth::Mailbox< T >
 Mailbox (cow_string const &name="Mailbox")
 
 Mailbox (cow_string &&name)
 
bool valid () const noexcept
 
 operator bool () const noexcept
 
bool can_put () const noexcept
 
bool can_take () const noexcept
 
void wait ()
 
void wait_empty ()
 
void put (type const &value)
 
Mailboxoperator= (type const &value)
 
void put (type &&value)
 
Mailboxoperator= (type &&value)
 
type take ()
 
- Public Member Functions inherited from zth::Synchronizer< 2 >
 Synchronizer ()=default
 
 Synchronizer (cow_string const &name)
 
 Synchronizer (cow_string &&name)
 
virtual ~Synchronizer () noexcept override
 
- Public Member Functions inherited from zth::SynchronizerBase
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 Member Functions

virtual void wait (typename base::assigned_type assigned) override
 
virtual base::assigned_type wakeup (Listable &item, typename base::queue_type::user_type user, bool prio) noexcept override
 
- Protected Member Functions inherited from zth::Mailbox< T >
bool valid (assigned_type assigned) const noexcept
 
type take (assigned_type assigned)
 
virtual void wakeup (Listable &item, queue_type::user_type user, bool prio, size_t q) noexcept final
 
virtual assigned_type wakeup (Listable &item, queue_type::user_type user, bool prio) noexcept
 
- Protected Member Functions inherited from zth::Synchronizer< 2 >
virtual queue_typequeue (size_t q) final
 
- Protected Member Functions inherited from zth::SynchronizerBase
 SynchronizerBase (cow_string const &name="Synchronizer")
 
 SynchronizerBase (cow_string &&name)
 
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
 
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
 

Additional Inherited Members

- Static Public Member Functions inherited from zth::UniqueID< SynchronizerBase >
static uint64_t getID () noexcept
 
- Protected Types inherited from zth::Mailbox< T >
enum  { Queue_Put = 0 , Queue_Take = 1 }
 
- Protected Types inherited from zth::Synchronizer< 2 >
typedef base::queue_type queue_type
 
- Protected Types inherited from zth::SynchronizerBase
typedef List queue_type
 

Detailed Description

template<typename T>
class zth::coro::Mailbox< T >

Definition at line 717 of file coro.h.

Member Typedef Documentation

◆ base

template<typename T >
using zth::coro::Mailbox< T >::base = zth::Mailbox<T>

Definition at line 720 of file coro.h.

◆ type

template<typename T >
using zth::coro::Mailbox< T >::type = typename base::type

Definition at line 721 of file coro.h.

Constructor & Destructor Documentation

◆ Mailbox()

template<typename T >
zth::coro::Mailbox< T >::Mailbox ( promise_base owner,
cow_string const &  name = "coro::Mailbox< T >" 
)
inlineexplicit

Definition at line 723 of file coro.h.

◆ ~Mailbox()

template<typename T >
virtual zth::coro::Mailbox< T >::~Mailbox ( )
overridevirtualdefaultnoexcept

Reimplemented from zth::Mailbox< T >.

Member Function Documentation

◆ abandon()

template<typename T >
void zth::coro::Mailbox< T >::abandon ( )
inline

Definition at line 766 of file coro.h.

◆ abandoned()

template<typename T >
bool zth::coro::Mailbox< T >::abandoned ( ) const
inlinenoexcept

Definition at line 772 of file coro.h.

◆ owner()

template<typename T >
promise_base & zth::coro::Mailbox< T >::owner ( ) const
inlinenoexcept

Definition at line 730 of file coro.h.

◆ take() [1/3]

template<typename T >
type zth::Mailbox< T >::take ( )
inline

Definition at line 1416 of file sync.h.

◆ take() [2/3]

template<typename T >
type zth::Mailbox< T >::take ( assigned_type  assigned)
inline

Definition at line 1422 of file sync.h.

◆ take() [3/3]

template<typename T >
type zth::coro::Mailbox< T >::take ( std::coroutine_handle<>  waiter)
inline

Definition at line 756 of file coro.h.

◆ valid() [1/3]

template<typename T >
bool zth::Mailbox< T >::valid ( ) const
inlinenoexcept

Definition at line 1322 of file sync.h.

◆ valid() [2/3]

template<typename T >
bool zth::Mailbox< T >::valid ( assigned_type  assigned) const
inlinenoexcept

Definition at line 1343 of file sync.h.

◆ valid() [3/3]

template<typename T >
bool zth::coro::Mailbox< T >::valid ( std::coroutine_handle<>  waiter) const
inlinenoexcept

Definition at line 741 of file coro.h.

◆ wait() [1/4]

template<typename T >
void zth::Mailbox< T >::wait ( )
inline

Definition at line 1349 of file sync.h.

◆ wait() [2/4]

template<typename T >
virtual void zth::Mailbox< T >::wait ( assigned_type  assigned)
inlinevirtual

Reimplemented from zth::Mailbox< T >.

Definition at line 1355 of file sync.h.

◆ wait() [3/4]

template<typename T >
void zth::coro::Mailbox< T >::wait ( Listable item,
std::coroutine_handle<>  waiter 
)
inlinenoexcept

Definition at line 748 of file coro.h.

◆ wait() [4/4]

template<typename T >
virtual void zth::coro::Mailbox< T >::wait ( typename base::assigned_type  assigned)
inlineoverrideprotectedvirtual

Reimplemented from zth::Mailbox< T >.

Definition at line 778 of file coro.h.

◆ waiter()

template<typename T >
std::coroutine_handle zth::coro::Mailbox< T >::waiter ( ) const
inlinenoexcept

Definition at line 736 of file coro.h.

◆ wakeup()

template<typename T >
virtual base::assigned_type zth::coro::Mailbox< T >::wakeup ( Listable item,
typename base::queue_type::user_type  user,
bool  prio 
)
inlineoverrideprotectedvirtualnoexcept

Definition at line 788 of file coro.h.


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