Zth (libzth)
zth::Future< T > Class Template Reference

Fiber-aware future. More...

#include <sync.h>

Inheritance diagram for zth::Future< T >:
zth::Synchronizer zth::RefCounted zth::UniqueID< Synchronizer > zth::UniqueIDBase

Public Types

typedef T type
 

Public Member Functions

 Future (cow_string const &name="Future")
 
 Future (cow_string &&name)
 
virtual ~Future () override
 
bool valid () const noexcept
 
 operator bool () const noexcept
 
void wait ()
 
void set ()
 
void set (type const &value)
 
Futureoperator= (type const &value)
 
void set (type &&value)
 
Futureoperator= (type &&value)
 
typevalue () &
 
type const & value () const &
 
type value () &&
 
type const * operator* () const
 
typeoperator* ()
 
type const * operator-> () const
 
typeoperator-> ()
 
- 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

template<typename T = void>
class zth::Future< T >

Fiber-aware future.

Examples
socks.cpp.

Definition at line 542 of file sync.h.

Member Typedef Documentation

◆ type

template<typename T = void>
typedef T zth::Future< T >::type

Definition at line 545 of file sync.h.

Constructor & Destructor Documentation

◆ Future() [1/2]

template<typename T = void>
zth::Future< T >::Future ( cow_string const &  name = "Future< T >")
inlineexplicit

Definition at line 548 of file sync.h.

◆ Future() [2/2]

template<typename T = void>
zth::Future< T >::Future ( cow_string &&  name)
inlineexplicit

Definition at line 559 of file sync.h.

◆ ~Future()

template<typename T = void>
virtual zth::Future< T >::~Future ( )
inlineoverridevirtual

Definition at line 569 of file sync.h.

Member Function Documentation

◆ operator bool()

template<typename T = void>
zth::Future< T >::operator bool ( ) const
inlinenoexcept

Definition at line 583 of file sync.h.

◆ operator*() [1/2]

template<typename T = void>
type* zth::Future< T >::operator* ( )
inline

Definition at line 663 of file sync.h.

◆ operator*() [2/2]

template<typename T = void>
type const* zth::Future< T >::operator* ( ) const
inline

Definition at line 658 of file sync.h.

◆ operator->() [1/2]

template<typename T = void>
type* zth::Future< T >::operator-> ( )
inline

Definition at line 673 of file sync.h.

◆ operator->() [2/2]

template<typename T = void>
type const* zth::Future< T >::operator-> ( ) const
inline

Definition at line 668 of file sync.h.

◆ operator=() [1/2]

template<typename T = void>
Future& zth::Future< T >::operator= ( type &&  value)
inline

Definition at line 628 of file sync.h.

◆ operator=() [2/2]

template<typename T = void>
Future& zth::Future< T >::operator= ( type const &  value)
inline

Definition at line 612 of file sync.h.

◆ set() [1/3]

template<typename T = void>
void zth::Future< T >::set ( )
inline

Definition at line 594 of file sync.h.

◆ set() [2/3]

template<typename T = void>
void zth::Future< T >::set ( type &&  value)
inline

Definition at line 619 of file sync.h.

◆ set() [3/3]

template<typename T = void>
void zth::Future< T >::set ( type const &  value)
inline

Definition at line 603 of file sync.h.

◆ valid()

template<typename T = void>
bool zth::Future< T >::valid ( ) const
inlinenoexcept

Definition at line 578 of file sync.h.

◆ value() [1/3]

template<typename T = void>
type& zth::Future< T >::value ( ) &
inline

Definition at line 635 of file sync.h.

◆ value() [2/3]

template<typename T = void>
type zth::Future< T >::value ( ) &&
inline

Definition at line 650 of file sync.h.

◆ value() [3/3]

template<typename T = void>
type const& zth::Future< T >::value ( ) const &
inline

Definition at line 642 of file sync.h.

◆ wait()

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

Definition at line 588 of file sync.h.


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