12 #ifdef ETL_PARALLEL_SUPPORT 21 template <
typename Pool>
22 struct conf_thread_engine {
30 static void acquire() {
33 cpp_assert(
etl::threads > 1,
"thread_engine cannot be used with less than 2");
42 template <
typename Functor,
typename... Args>
43 static void schedule(Functor&& fun, Args&&... args) {
44 get_pool().do_task(std::forward<Functor>(fun), std::forward<Args>(args)...);
59 static Pool& get_pool() {
65 using thread_engine = conf_thread_engine<cpp::default_thread_pool<>>;
84 cpp_unreachable(
"thread_engine can only be used if paralle support is enabled");
91 template <
typename Functor,
typename... Args>
92 static void schedule([[maybe_unused]] Functor&& fun, [[maybe_unused]] Args&&... args) {
93 cpp_unreachable(
"thread_engine can only be used if paralle support is enabled");
100 cpp_unreachable(
"thread_engine can only be used if paralle support is enabled");
The default thread engine when auto-parallelization is not enabled.
Definition: thread_engine.hpp:75
static void schedule([[maybe_unused]] Functor &&fun, [[maybe_unused]] Args &&... args)
Schedule a new task.
Definition: thread_engine.hpp:92
Root namespace for the ETL library.
Definition: adapter.hpp:15
context & local_context()
Return the configuration context of the current thread.
Definition: context.hpp:50
static void acquire()
Acquire the thread engine.
Definition: thread_engine.hpp:83
const size_t threads
The number of threads ETL can use in parallel mode.
Definition: config.hpp:45
constexpr bool parallel_support
Indicates if support for parallelization is integrated into the framework.
Definition: config.hpp:51
auto serial(Expr &&expr) -> serial_expr< detail::build_type< Expr >>
Create a serial expression wrapping the given expression.
Definition: wrapper_expression_builder.hpp:66
bool is_parallel_session()
Indicates if a parallel session is currently active.
Definition: parallel_session.hpp:59
static void wait()
Wait for all the scheduled threads to finish their task.
Definition: thread_engine.hpp:99