Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
kcenon::thread::pool_promise< T > Class Template Reference

A promise that can schedule work on a thread pool. More...

#include <future_extensions.h>

Collaboration diagram for kcenon::thread::pool_promise< T >:
Collaboration graph

Public Types

using value_type = T
 

Public Member Functions

 pool_promise ()=default
 Default constructor.
 
pool_future< T > get_future ()
 Get the associated future.
 
void set_value (const T &value)
 Set the value.
 
void set_value (T &&value)
 Set the value (move)
 
void set_exception (std::exception_ptr exception)
 Set an exception.
 
void set_value_at_thread_exit (const T &value)
 Set the value at thread exit.
 
void set_exception_at_thread_exit (std::exception_ptr exception)
 Set an exception at thread exit.
 

Private Attributes

std::promise< T > promise_
 

Detailed Description

template<typename T>
class kcenon::thread::pool_promise< T >

A promise that can schedule work on a thread pool.

Definition at line 91 of file future_extensions.h.

Member Typedef Documentation

◆ value_type

template<typename T >
using kcenon::thread::pool_promise< T >::value_type = T

Definition at line 93 of file future_extensions.h.

Constructor & Destructor Documentation

◆ pool_promise()

template<typename T >
kcenon::thread::pool_promise< T >::pool_promise ( )
default

Default constructor.

Member Function Documentation

◆ get_future()

template<typename T >
pool_future< T > kcenon::thread::pool_promise< T >::get_future ( )
inline

Get the associated future.

Definition at line 103 of file future_extensions.h.

103 {
104 return pool_future<T>{promise_.get_future()};
105 }

References kcenon::thread::pool_promise< T >::promise_.

Referenced by kcenon::thread::make_exceptional_future(), kcenon::thread::make_ready_future(), and kcenon::thread::make_ready_future().

Here is the caller graph for this function:

◆ set_exception()

template<typename T >
void kcenon::thread::pool_promise< T >::set_exception ( std::exception_ptr exception)
inline

Set an exception.

Definition at line 124 of file future_extensions.h.

124 {
125 promise_.set_exception(exception);
126 }

References kcenon::thread::pool_promise< T >::promise_.

Referenced by kcenon::thread::make_exceptional_future().

Here is the caller graph for this function:

◆ set_exception_at_thread_exit()

template<typename T >
void kcenon::thread::pool_promise< T >::set_exception_at_thread_exit ( std::exception_ptr exception)
inline

Set an exception at thread exit.

Definition at line 138 of file future_extensions.h.

138 {
139 promise_.set_exception_at_thread_exit(exception);
140 }

References kcenon::thread::pool_promise< T >::promise_.

◆ set_value() [1/2]

template<typename T >
void kcenon::thread::pool_promise< T >::set_value ( const T & value)
inline

Set the value.

Definition at line 110 of file future_extensions.h.

110 {
111 promise_.set_value(value);
112 }

References kcenon::thread::pool_promise< T >::promise_.

Referenced by kcenon::thread::make_ready_future(), and kcenon::thread::make_ready_future().

Here is the caller graph for this function:

◆ set_value() [2/2]

template<typename T >
void kcenon::thread::pool_promise< T >::set_value ( T && value)
inline

Set the value (move)

Definition at line 117 of file future_extensions.h.

117 {
118 promise_.set_value(std::move(value));
119 }

References kcenon::thread::pool_promise< T >::promise_.

◆ set_value_at_thread_exit()

template<typename T >
void kcenon::thread::pool_promise< T >::set_value_at_thread_exit ( const T & value)
inline

Set the value at thread exit.

Definition at line 131 of file future_extensions.h.

131 {
132 promise_.set_value_at_thread_exit(value);
133 }

References kcenon::thread::pool_promise< T >::promise_.

Member Data Documentation

◆ promise_


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