threadman 0.1.0
Header-only C++23 managed threads, dynamic pools, futures, and executors
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
threadman::detail::FutureState< T > Class Template Reference

#include <future.hpp>

Inheritance diagram for threadman::detail::FutureState< T >:
Inheritance graph
[legend]
Collaboration diagram for threadman::detail::FutureState< T >:
Collaboration graph
[legend]

Public Types

enum class  AddResult { Scheduled , AlreadyReady }
 Register a continuation. More...
 
using value_type = T
 
using Continuation = std::function< void()>
 

Public Member Functions

bool ready () const noexcept
 
bool has_exception () const noexcept
 
std::uint32_t continuation_count () const noexcept
 
FutureSnapshot snapshot (const bool shared) const
 
template<class U = T>
requires (!std::is_void_v<U>)
void set_value (U &&v)
 
template<class U = T>
requires std::is_void_v<U>
void set_value ()
 
void set_exception (const std::exception_ptr &ex)
 
void wait () const
 
template<class Rep , class Period >
bool wait_for (const std::chrono::duration< Rep, Period > &dur) const
 
template<class Clock , class Duration >
bool wait_until (const std::chrono::time_point< Clock, Duration > &tp) const
 
template<class U = T>
requires (!std::is_void_v<U>)
get_value_move ()
 Block until ready, then either return the value (move/copy depending on T) or rethrow the captured exception.
 
template<class U = T>
requires (!std::is_void_v<U>)
const U & get_value_ref () const
 
template<class U = T>
requires std::is_void_v<U>
void get_value_void () const
 
AddResult add_continuation (Continuation cb)
 
std::exception_ptr exception () const noexcept
 

Member Typedef Documentation

◆ Continuation

template<class T >
using threadman::detail::FutureState< T >::Continuation = std::function<void()>

◆ value_type

template<class T >
using threadman::detail::FutureState< T >::value_type = T

Member Enumeration Documentation

◆ AddResult

template<class T >
enum class threadman::detail::FutureState::AddResult
strong

Register a continuation.

If the state is already ready, the continuation is not run inline here — the caller is responsible for scheduling it through the executor.

Enumerator
Scheduled 
AlreadyReady 

Member Function Documentation

◆ add_continuation()

template<class T >
AddResult threadman::detail::FutureState< T >::add_continuation ( Continuation  cb)
inline

◆ continuation_count()

template<class T >
std::uint32_t threadman::detail::FutureState< T >::continuation_count ( ) const
inlinenoexcept

◆ exception()

template<class T >
std::exception_ptr threadman::detail::FutureState< T >::exception ( ) const
inlinenoexcept

◆ get_value_move()

template<class T >
template<class U = T>
requires (!std::is_void_v<U>)
U threadman::detail::FutureState< T >::get_value_move ( )
inline

Block until ready, then either return the value (move/copy depending on T) or rethrow the captured exception.

◆ get_value_ref()

template<class T >
template<class U = T>
requires (!std::is_void_v<U>)
const U & threadman::detail::FutureState< T >::get_value_ref ( ) const
inline

◆ get_value_void()

template<class T >
template<class U = T>
requires std::is_void_v<U>
void threadman::detail::FutureState< T >::get_value_void ( ) const
inline

◆ has_exception()

template<class T >
bool threadman::detail::FutureState< T >::has_exception ( ) const
inlinenoexcept

◆ ready()

template<class T >
bool threadman::detail::FutureState< T >::ready ( ) const
inlinenoexcept

◆ set_exception()

template<class T >
void threadman::detail::FutureState< T >::set_exception ( const std::exception_ptr &  ex)
inline

◆ set_value() [1/2]

template<class T >
template<class U = T>
requires std::is_void_v<U>
void threadman::detail::FutureState< T >::set_value ( )
inline

◆ set_value() [2/2]

template<class T >
template<class U = T>
requires (!std::is_void_v<U>)
void threadman::detail::FutureState< T >::set_value ( U &&  v)
inline

◆ snapshot()

template<class T >
FutureSnapshot threadman::detail::FutureState< T >::snapshot ( const bool  shared) const
inline

◆ wait()

template<class T >
void threadman::detail::FutureState< T >::wait ( ) const
inline

◆ wait_for()

template<class T >
template<class Rep , class Period >
bool threadman::detail::FutureState< T >::wait_for ( const std::chrono::duration< Rep, Period > &  dur) const
inline

◆ wait_until()

template<class T >
template<class Clock , class Duration >
bool threadman::detail::FutureState< T >::wait_until ( const std::chrono::time_point< Clock, Duration > &  tp) const
inline

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