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

#include <future.hpp>

Public Types

using value_type = T
 

Public Member Functions

 Future ()=default
 
 Future (const Future &)=delete
 
Futureoperator= (const Future &)=delete
 
 Future (Future &&) noexcept=default
 
Futureoperator= (Future &&) noexcept=default
 
 ~Future ()=default
 
bool valid () const noexcept
 
bool is_ready () const noexcept
 
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 ()
 Block, then consume — second get() throws.
 
template<class U = T>
requires std::is_void_v<U>
void get ()
 
SharedFuture< T > share ()
 Convert to a multi-shot SharedFuture. Future is invalidated.
 
template<class Exec , class Fn >
auto then (Exec &exec, Fn &&fn)
 Register a continuation; consumes this future.
 
template<class Exec , class Fn >
Future< T > on_error (Exec &exec, Fn &&fn)
 Recover from a captured exception by running fn(exception_ptr).
 
FutureSnapshot snapshot () const
 

Static Public Member Functions

static const comms::DisplayInfo & display_info ()
 

Friends

template<class U >
class Promise
 
template<class U >
class SharedFuture
 
template<class U >
class Future
 

Member Typedef Documentation

◆ value_type

template<class T >
using threadman::Future< T >::value_type = T

Constructor & Destructor Documentation

◆ Future() [1/3]

template<class T >
threadman::Future< T >::Future ( )
default

◆ Future() [2/3]

template<class T >
threadman::Future< T >::Future ( const Future< T > &  )
delete

◆ Future() [3/3]

template<class T >
threadman::Future< T >::Future ( Future< T > &&  )
defaultnoexcept

◆ ~Future()

template<class T >
threadman::Future< T >::~Future ( )
default

Member Function Documentation

◆ display_info()

template<class T >
static const comms::DisplayInfo & threadman::Future< T >::display_info ( )
inlinestatic

◆ get() [1/2]

template<class T >
template<class U = T>
requires (!std::is_void_v<U>)
U threadman::Future< T >::get ( )
inline

Block, then consume — second get() throws.

◆ get() [2/2]

template<class T >
template<class U = T>
requires std::is_void_v<U>
void threadman::Future< T >::get ( )
inline

◆ is_ready()

template<class T >
bool threadman::Future< T >::is_ready ( ) const
inlinenoexcept

◆ on_error()

template<class T >
template<class Exec , class Fn >
Future< T > threadman::Future< T >::on_error ( Exec &  exec,
Fn &&  fn 
)

Recover from a captured exception by running fn(exception_ptr).

Returns a new Future<T> that completes with either the original value or the recovered value from fn.

◆ operator=() [1/2]

template<class T >
Future & threadman::Future< T >::operator= ( const Future< T > &  )
delete

◆ operator=() [2/2]

template<class T >
Future & threadman::Future< T >::operator= ( Future< T > &&  )
defaultnoexcept

◆ share()

template<class T >
SharedFuture< T > threadman::Future< T >::share ( )

Convert to a multi-shot SharedFuture. Future is invalidated.

◆ snapshot()

template<class T >
FutureSnapshot threadman::Future< T >::snapshot ( ) const
inline

◆ then()

template<class T >
template<class Exec , class Fn >
auto threadman::Future< T >::then ( Exec &  exec,
Fn &&  fn 
)

Register a continuation; consumes this future.

A second .then on the same source raises ContinuationAlreadyRegisteredError.

◆ valid()

template<class T >
bool threadman::Future< T >::valid ( ) const
inlinenoexcept

◆ wait()

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

◆ wait_for()

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

◆ wait_until()

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

Friends And Related Symbol Documentation

◆ Future

template<class T >
template<class U >
friend class Future
friend

◆ Promise

template<class T >
template<class U >
friend class Promise
friend

◆ SharedFuture

template<class T >
template<class U >
friend class SharedFuture
friend

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