ORIGINAL
Loading...
Searching...
No Matches
Classes | Static Public Member Functions | List of all members
original::async Class Reference

Asynchronous programming utilities with future/promise pattern. More...

#include <async.h>

Collaboration diagram for original::async:
Collaboration graph

Classes

class  asyncWrapper< void >
 Specialization of asyncWrapper for void results. More...
 
class  future
 Represents a one-shot future result of an asynchronous computation. More...
 
class  future< void >
 Specialization of future for void results. More...
 
class  futureBase
 Abstract base interface for asynchronous consumers. More...
 
class  promise
 Represents a one-time asynchronous producer with result setting capability. More...
 
class  promise< void, Callback >
 Specialization of promise for void results. More...
 
class  sharedFuture
 Represents a sharable asynchronous result. More...
 
class  sharedFuture< void >
 

Static Public Member Functions

template<typename Callback , typename... Args>
static auto makePromise (Callback &&c, Args &&... args)
 Creates a promise from a callable and arguments.
 
template<typename Callback , typename... Args>
static auto get (Callback &&c, Args &&... args) -> future< std::invoke_result_t< std::decay_t< Callback >, std::decay_t< Args >... > >
 Executes a callable asynchronously and returns a future for the result.
 

Detailed Description

Asynchronous programming utilities with future/promise pattern.

Provides a thread-safe implementation of the future/promise pattern for asynchronous computation. Supports both value-returning and void functions.

Member Function Documentation

◆ get()

template<typename Callback , typename ... Args>
auto original::async::get ( Callback &&  c,
Args &&...  args 
) -> future<std::invoke_result_t<std::decay_t<Callback>, std::decay_t<Args>...>>
static

Executes a callable asynchronously and returns a future for the result.

Template Parameters
CallbackThe type of the callable
ArgsThe types of the arguments
Parameters
cCallable to execute
argsArguments to forward to the callable
Returns
A future that will hold the result of the computation

◆ makePromise()

template<typename Callback , typename... Args>
auto original::async::makePromise ( Callback &&  c,
Args &&...  args 
)
static

Creates a promise from a callable and arguments.

Template Parameters
CallbackThe type of the callable
ArgsThe types of the arguments
Parameters
cCallable to execute asynchronously
argsArguments to forward to the callable
Returns
A promise object for the asynchronous computation

The created promise is a single-use object that can be executed exactly once via run() or have its function extracted via function().


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