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< Size > zth::SynchronizerBase zth::RefCounted zth::UniqueID< SynchronizerBase > zth::NamedUniqueID< Named > zth::UniqueIDBase

Public Types

typedef T type
 
typedef typeindirection_type
 
typedef typemember_type
 
- Public Types inherited from zth::Synchronizer< Size >
typedef SynchronizerBase base
 
- Public Types inherited from zth::UniqueID< SynchronizerBase >
typedef NamedUniqueID base
 

Public Member Functions

 Future (cow_string const &name="Future")
 
 Future (cow_string &&name)
 
virtual ~Future () noexcept override=default
 
bool valid () const noexcept
 
 operator bool () const noexcept
 
void wait ()
 
void set (type const &value=type()) noexcept
 
Futureoperator= (type const &value) noexcept
 
void set (type &&value) noexcept
 
Futureoperator= (type &&value) noexcept
 
typevalue () &
 
indirection_type operator* () &
 
member_type operator-> ()
 
type && value () &&
 
type && operator* () &&
 
- Public Member Functions inherited from zth::Synchronizer< Size >
 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
 

Additional Inherited Members

- Static Public Member Functions inherited from zth::UniqueID< SynchronizerBase >
static uint64_t getID () noexcept
 
- Protected Types inherited from zth::Synchronizer< Size >
typedef base::queue_type queue_type
 
- Protected Types inherited from zth::SynchronizerBase
typedef List queue_type
 
- Protected Member Functions inherited from zth::Synchronizer< Size >
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
 
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
 

Detailed Description

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

Fiber-aware future.

Definition at line 1068 of file sync.h.

Member Typedef Documentation

◆ indirection_type

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

Definition at line 1072 of file sync.h.

◆ member_type

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

Definition at line 1073 of file sync.h.

◆ type

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

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

◆ Future() [2/2]

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

Definition at line 1080 of file sync.h.

◆ ~Future()

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

Member Function Documentation

◆ operator bool()

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

Definition at line 1092 of file sync.h.

◆ operator*() [1/2]

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

Definition at line 1157 of file sync.h.

◆ operator*() [2/2]

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

Definition at line 1174 of file sync.h.

◆ operator->()

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

Definition at line 1162 of file sync.h.

◆ operator=() [1/2]

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

Definition at line 1124 of file sync.h.

◆ operator=() [2/2]

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

Definition at line 1110 of file sync.h.

◆ set() [1/2]

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

Definition at line 1117 of file sync.h.

◆ set() [2/2]

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

Definition at line 1103 of file sync.h.

◆ valid()

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

Definition at line 1087 of file sync.h.

◆ value() [1/2]

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

Definition at line 1151 of file sync.h.

◆ value() [2/2]

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

Definition at line 1168 of file sync.h.

◆ wait()

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

Definition at line 1097 of file sync.h.


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