hpx/executors/fork_join_executor.hpp¶
See Public API for a list of names and headers that are part of the public HPX API.
-
namespace
hpx
-
namespace
execution
-
namespace
experimental
Functions
-
std::ostream &
operator<<
(std::ostream &os, fork_join_executor::loop_schedule const &schedule)¶
-
class
fork_join_executor
¶ - #include <fork_join_executor.hpp>
An executor with fork-join (blocking) semantics.
The fork_join_executor creates on construction a set of worker threads that are kept alive for the duration of the executor. Copying the executor has reference semantics, i.e. copies of a fork_join_executor hold a reference to the worker threads of the original instance. Scheduling work through the executor concurrently from different threads is undefined behaviour.
The executor keeps a set of worker threads alive for the lifetime of the executor, meaning other work will not be executed while the executor is busy or waiting for work. The executor has a customizable delay after which it will yield to other work. Since starting and resuming the worker threads is a slow operation the executor should be reused whenever possible for multiple adjacent parallel algorithms or invocations of bulk_(a)sync_execute.
Public Types
-
enum
loop_schedule
¶ Type of loop schedule for use with the fork_join_executor. loop_schedule::static_ implies no work-stealing; loop_schedule::dynamic allows stealing when a worker has finished its local work.
Values:
-
static_
¶
-
dynamic
¶
-
Public Functions
-
fork_join_executor
(threads::thread_priority priority = threads::thread_priority::high, threads::thread_stacksize stacksize = threads::thread_stacksize::small_, loop_schedule schedule = loop_schedule::static_, std::chrono::nanoseconds yield_delay = std::chrono::milliseconds(1))¶ Construct a fork_join_executor.
- Parameters
priority
: The priority of the worker threads.stacksize
: The stacksize of the worker threads. Must not be nostack.schedule
: The loop schedule of the parallel regions.yield_delay
: The time after which the executor yields to other work if it hasn’t received any new work for bulk execution.
-
enum
-
std::ostream &
-
namespace
-
namespace