LibraryLink Utilities  3.0.1
Modern C++ wrapper over LibraryLink and WSTP
Async/Utilities.h File Reference

Set of small utility classes and functions used in the Async part of LLU. More...

Detailed Description

Set of small utility classes and functions used in the Async part of LLU.

Author
Rafal Chojna rafal.nosp@m.c@wo.nosp@m.lfram.nosp@m..com
#include <functional>
#include <future>
#include <memory>
#include <thread>
#include <vector>
+ Include dependency graph for Async/Utilities.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  LLU::Async::FunctionWrapper
 Wraps an arbitrary callable object (possibly binding its arguments) to be evaluated later. The callable object, when called on provided arguments, must return void. More...
 
class  LLU::Async::ThreadJoiner
 A guard for a vector of threads to make sure they are joined before their destruction. The developer must ensure that the lifetime a ThreadJoiner does not exceed the lifetime of the vector it guards. More...
 
class  LLU::Async::Pausable
 Utility class for pausable task queues. More...
 

Namespaces

 LLU
 Main namespace of LibraryLink Utilities.
 

Functions

template<typename FunctionType , typename... Args>
std::packaged_task< std::invoke_result_t< FunctionType, Args... >)> LLU::Async::getPackagedTask (FunctionType &&f, Args &&... args)
 Create a std::packaged_task from a callable object and arguments to it. More...
 

Function Documentation

◆ getPackagedTask()

template<typename FunctionType , typename... Args>
std::packaged_task<std::invoke_result_t<FunctionType, Args...>)> LLU::Async::getPackagedTask ( FunctionType &&  f,
Args &&...  args 
)

Create a std::packaged_task from a callable object and arguments to it.

Template Parameters
FunctionType- arbitrary type of a callable object
Args- paramater pack with function argument types
Parameters
f- callable object
args- arguments for a call to f
Returns
a call to f with arguments args wrapped in a std::packaged_task