ladivic
|
Provides utilities for asynchronous execution in C++. More...
#include <future>
Go to the source code of this file.
Functions | |
template<typename F , typename... A> | |
std::future< typename std::result_of< F(A...)>::type > | ldvc_async_execute (F &&f, A &&... args) |
Executes a function asynchronously. | |
template<typename R , typename P , typename F , typename... A> | |
std::future< typename std::result_of< F(A...)>::type > | ldvc_async_execute_with_delay (const std::chrono::duration< R, P > &delay, F &&f, A &&... args) |
Executes a function asynchronously with a delay. | |
template<typename R , typename P , typename F , typename... A> | |
std::future< typename std::result_of< F(A...)>::type > | ldvc_async_execute_with_timeout (const std::chrono::duration< R, P > &timeout, F &&f, A &&... args) |
Executes a function asynchronously with a timeout. | |
Provides utilities for asynchronous execution in C++.
This header file defines functions for executing tasks asynchronously in C++, providing capabilities for delayed execution and timeout handling.
Definition in file ldvc_async.hpp.
std::future< typename std::result_of< F(A...)>::type > ldvc_async_execute | ( | F && | f, |
A &&... | args ) |
Executes a function asynchronously.
This function executes the given function f
asynchronously, along with its arguments args
. It returns a std::future object representing the result of the function call.
F | The type of the function to be executed. |
A | The types of the arguments to the function. |
f | The function to be executed. |
args | The arguments to the function. |
Definition at line 60 of file ldvc_async.hpp.
std::future< typename std::result_of< F(A...)>::type > ldvc_async_execute_with_delay | ( | const std::chrono::duration< R, P > & | delay, |
F && | f, | ||
A &&... | args ) |
Executes a function asynchronously with a delay.
This function executes the given function f
asynchronously, along with its arguments args
, after the specified delay. It returns a std::future object representing the result of the function call.
R | The type of the delay duration. |
P | The type of the delay duration. |
F | The type of the function to be executed. |
A | The types of the arguments to the function. |
delay | The delay duration before executing the function. |
f | The function to be executed. |
args | The arguments to the function. |
Definition at line 93 of file ldvc_async.hpp.
std::future< typename std::result_of< F(A...)>::type > ldvc_async_execute_with_timeout | ( | const std::chrono::duration< R, P > & | timeout, |
F && | f, | ||
A &&... | args ) |
Executes a function asynchronously with a timeout.
This function executes the given function f
asynchronously, along with its arguments args
, and provides a timeout mechanism. If the function does not complete within the specified timeout duration, an exception is thrown.
R | The type of the timeout duration. |
P | The type of the timeout duration. |
F | The type of the function to be executed. |
A | The types of the arguments to the function. |
timeout | The timeout duration for the function execution. |
f | The function to be executed. |
args | The arguments to the function. |
std::runtime_error | Thrown if the function execution exceeds the specified timeout duration. |
Definition at line 130 of file ldvc_async.hpp.