Zth (libzth)
Loading...
Searching...
No Matches
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 () override=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.
 
bool unblockFirst () noexcept
 
bool unblockAll () noexcept
 
bool block (Timestamp const &timeout, Timestamp const &now=Timestamp::now())
 Block, with timeout.
 
bool block (TimeInterval const &timeout, Timestamp const &now=Timestamp::now())
 Block, with timeout.
 
- 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 598 of file sync.h.

Member Typedef Documentation

◆ type

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

Definition at line 601 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 604 of file sync.h.

◆ Future() [2/2]

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

Definition at line 615 of file sync.h.

◆ ~Future()

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

Definition at line 625 of file sync.h.

Member Function Documentation

◆ operator bool()

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

Definition at line 643 of file sync.h.

◆ operator*() [1/2]

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

Definition at line 763 of file sync.h.

◆ operator*() [2/2]

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

Definition at line 758 of file sync.h.

◆ operator->() [1/2]

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

Definition at line 773 of file sync.h.

◆ operator->() [2/2]

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

Definition at line 768 of file sync.h.

◆ operator=() [1/2]

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

Definition at line 688 of file sync.h.

◆ operator=() [2/2]

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

Definition at line 672 of file sync.h.

◆ set() [1/3]

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

Definition at line 654 of file sync.h.

◆ set() [2/3]

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

Definition at line 679 of file sync.h.

◆ set() [3/3]

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

Definition at line 663 of file sync.h.

◆ valid()

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

Definition at line 638 of file sync.h.

◆ value() [1/3]

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

Definition at line 717 of file sync.h.

◆ value() [2/3]

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

Definition at line 744 of file sync.h.

◆ value() [3/3]

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

Definition at line 730 of file sync.h.

◆ wait()

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

Definition at line 648 of file sync.h.


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