AMFuture  201909
String localization library
Classes | Typedefs | Functions
AMFuture.h File Reference
#include <functional>
#include <chrono>
#include <type_traits>
#include <cassert>
#include <future>
#include <set>
Include dependency graph for AMFuture.h:

Go to the source code of this file.

Classes

class  AMCore::AMFuture< T >
 Result of type T of asynchronous call. More...
 
class  AMCore::AMFuture< T >
 Result of type T of asynchronous call. More...
 

Typedefs

typedef std::future_status AMCore::AMFutureStatus
 Status of future is exacly the same as std::future_status.
 
typedef std::launch AMCore::AMLaunch
 Launch mode is exactly the same as std::launch.
 

Functions

template<class Callback , class AvailCallback , class Function , class TCF , class... Args>
AMFuture< std::invoke_result_t< std::decay_t< Callback >, TCF, void * > > AMCore::AMAsync (AMLaunch policy, Callback &&callback, AvailCallback &&a, Function &&f, TCF &&tcf, Args &&... args)
 asynchronous call More...
 
bool AMCore::checkZombies ()
 Check for active AMFuture. More...
 

Detailed Description

std::async wrapper for both multithreaded and singlethreaded system

Author
Zdeněk Skulínek <me@zdenekskulinek.cz>

Function Documentation

◆ AMAsync()

template<class Callback , class AvailCallback , class Function , class TCF , class... Args>
AMFuture< std::invoke_result_t< std::decay_t< Callback >, TCF, void * > > AMCore::AMAsync ( AMLaunch  policy,
Callback &&  callback,
AvailCallback &&  a,
Function &&  f,
TCF &&  tcf,
Args &&...  args 
)

asynchronous call

Launch, possible asynchronous a function.

Template Parameters
CallbackGet data function. Return type is T (From AMFuture<T>) a parameter is your own tag of type void *. It must be member function of type TCF.
AvailCallbackCheck, if data is available. Tou need not implement this function. It must be member function of type TCF.
FunctionPrepare data function. It should return unique tag tied with result. Return type is a tag of void *. It must be member function of type TCF.
TCFCaller object type.
ArgsAll parameters of Function. It's absolutly free.
Parameters
policyvalid is AMLaunch::async
callbackCallback type function.
aAvailCallback type function.
fFunction type function.
tcfCaller object.
argsFree paramater that f have.
Returns
AMFuture<T>

◆ checkZombies()

bool AMCore::checkZombies ( )
inline

Check for active AMFuture.

Returns
That destroy of application is safe

References AMCore::checkZombies().

Referenced by AMCore::checkZombies().