20 #ifndef SC_INCLUDE_DYNAMIC_PROCESSES
21 #define SC_INCLUDE_DYNAMIC_PROCESSES
23 #include "sc_thread_pool.h"
27 sc_thread_pool::sc_thread_pool()
28 : sc_core::sc_object(sc_core::sc_gen_unique_name(
"pool")) {}
30 sc_thread_pool::~sc_thread_pool() =
default;
32 void sc_thread_pool::execute(std::function<
void(
void)> fct) {
33 sc_core::sc_spawn_options opts;
34 opts.set_stack_size(0x10000);
35 if((thread_avail == 0 || dispatch_queue.has_next()) && thread_active < max_concurrent_threads.get_value())
41 auto fct = dispatch_queue.get();
42 sc_assert(thread_avail > 0);
48 dispatch_queue.notify(std::move(fct));