scc  2022.4.0
SystemC components library
util::thread_syncronizer Class Reference

executes a function syncronized in another thread More...

#include <thread_syncronizer.h>

Public Member Functions

 thread_syncronizer ()=default
 
 ~thread_syncronizer ()
 
bool is_ready ()
 
template<class F , class... Args>
std::result_of< F(Args...)>::type enqueue_and_wait (F &&f, Args &&... args)
 
template<class F , class... Args>
auto enqueue (F &&f, Args &&... args) -> std::future< typename std::result_of< F(Args...)>::type >
 
void execute ()
 
void executeNext ()
 

Detailed Description

executes a function syncronized in another thread

Definition at line 34 of file thread_syncronizer.h.

Constructor & Destructor Documentation

◆ thread_syncronizer()

util::thread_syncronizer::thread_syncronizer ( )
default

the constructor.

◆ ~thread_syncronizer()

util::thread_syncronizer::~thread_syncronizer ( )
inline

the destructor

Definition at line 49 of file thread_syncronizer.h.

Member Function Documentation

◆ enqueue()

template<class F , class... Args>
auto util::thread_syncronizer::enqueue ( F &&  f,
Args &&...  args 
) -> std::future<typename std::result_of<F(Args...)>::type>
inline

enqueue a function to be executed in the other thread

Parameters
fthe functor to execute
argsthe arguments to pass to the functor
Returns
the future holding the result of the execution

Definition at line 78 of file thread_syncronizer.h.

◆ enqueue_and_wait()

template<class F , class... Args>
std::result_of<F(Args...)>::type util::thread_syncronizer::enqueue_and_wait ( F &&  f,
Args &&...  args 
)
inline

enqueue a function to be executed in the other thread and wait for completion

Parameters
fthe functor to execute
argsthe arguments to pass to the functor
Returns
the result of the function

Definition at line 66 of file thread_syncronizer.h.

◆ execute()

void util::thread_syncronizer::execute ( )
inline

execute the next task in queue but do not wait for the next one

Definition at line 93 of file thread_syncronizer.h.

◆ executeNext()

void util::thread_syncronizer::executeNext ( )
inline

execute the next task in queue or wait for the next one

Definition at line 115 of file thread_syncronizer.h.

◆ is_ready()

bool util::thread_syncronizer::is_ready ( )
inline

check if the synchronizer can handle functions

Returns
true if it can handle a new request

Definition at line 58 of file thread_syncronizer.h.


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