9#ifndef STLAB_CONCURRENCY_DEFAULT_EXECUTOR_HPP
10#define STLAB_CONCURRENCY_DEFAULT_EXECUTOR_HPP
41#include <stlab/execution/config.hpp>
77 void* source)
noexcept;
90 void* source)
noexcept;
103 void* source)
noexcept;
119STLAB_EXECUTION_VERSION_NAMESPACE_BEGIN()
129namespace execution_detail {
133enum class executor_priority : std::uint8_t { high, medium, low };
140inline void submit_executor_proc(executor_priority priority,
task<
void()
noexcept>& t) {
141 const auto* task_abi_guard = ¤t_task_storage_abi_guard::value;
142 const auto* vtable = t.relocation_concept();
143 const auto invoke = t.relocation_invoke();
144 auto* source = t.relocation_source();
146 case executor_priority::high:
149 case executor_priority::medium:
152 case executor_priority::low:
160template <executor_priority P = executor_priority::medium>
161struct executor_type {
162 using result_type = void;
169 auto operator()(F&& f)
const -> std::enable_if_t<std::is_nothrow_invocable_v<std::decay_t<F>>> {
170 task<void()
noexcept> t{std::forward<F>(f)};
171 submit_executor_proc(P, t);
184 execution_detail::executor_type<execution_detail::executor_priority::low>{};
187 execution_detail::executor_type<execution_detail::executor_priority::medium>{};
191 execution_detail::executor_type<execution_detail::executor_priority::high>{};
197STLAB_EXECUTION_VERSION_NAMESPACE_END()
constexpr auto low_executor
Low-priority concurrent executor. Portable executors prioritize queued work without changing OS threa...
Definition default_executor.hpp:183
constexpr auto default_executor
Default concurrent executor using the medium-priority queue.
Definition default_executor.hpp:186
constexpr auto high_executor
High-priority concurrent executor. Portable executors prioritize queued work without changing OS thre...
Definition default_executor.hpp:190
std::int32_t stlab_v2_default_executor_supports_blocking() noexcept
Returns one when the configured core supports blocking waits, otherwise zero.
void stlab_v2_default_executor_submit(const unsigned char *task_abi_guard, const stlab_v2_task_concept *vtable, stlab_v2_task_proc invoke, void *source) noexcept
Submits one task to the shared default-priority executor.
void stlab_v2_low_executor_submit(const unsigned char *task_abi_guard, const stlab_v2_task_concept *vtable, stlab_v2_task_proc invoke, void *source) noexcept
Submits one task to the shared low-priority executor.
void stlab_v2_high_executor_submit(const unsigned char *task_abi_guard, const stlab_v2_task_concept *vtable, stlab_v2_task_proc invoke, void *source) noexcept
Submits one task to the shared high-priority executor.
void stlab_v2_notify_default_executor_before_waiting() noexcept
Notifies the shared default executor that the calling thread is about to wait.
void(*)(void *) noexcept stlab_v2_task_proc
Function pointer type submitted through the shared executor ABI.
Definition default_executor.hpp:64
typename noexcept_deducer< task_, F >::type task
task_ with noexcept deduced from the function type F (e.g. void() vs void() noexcept).
Definition task.hpp:453
Definition default_executor.hpp:50
Definition default_executor.hpp:49
Versioned operation table used to relocate a task target across the shared executor ABI.
Definition task.hpp:64
Move-only callable wrapper for executor scheduling (task<Signature>).