scc 2026.07
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 (size_t queue_capacity=default_queue_capacity)
 ~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 36 of file thread_syncronizer.h.

Constructor & Destructor Documentation

◆ thread_syncronizer()

util::thread_syncronizer::thread_syncronizer ( size_t queue_capacity = default_queue_capacity)
inlineexplicit

the constructor.

Definition at line 50 of file thread_syncronizer.h.

◆ ~thread_syncronizer()

util::thread_syncronizer::~thread_syncronizer ( )
inline

the destructor

Definition at line 55 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< typenamestd::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 92 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 75 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 109 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 124 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 64 of file thread_syncronizer.h.


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