stlab 2.3.0
Modern, modular C++ algorithms, data structures, and concurrency primitives
Loading...
Searching...
No Matches
default_executor.hpp File Reference

Thread-pool executors mapping to the OS scheduler (libdispatch, Windows pool, portable). More...

#include <stlab/config.hpp>
#include <cassert>
#include <cstdint>
#include <type_traits>
#include <utility>

Go to the source code of this file.

Variables

constexpr auto stlab::low_executor
 Default task pool executor using low thread priority (when using the portable or Windows task system).
constexpr auto stlab::default_executor
 Default concurrent executor used by stlab::async and related APIs when none is specified.
constexpr auto stlab::high_executor
 Default task pool executor using high thread priority (when using the portable or Windows task system).

Detailed Description

Thread-pool executors mapping to the OS scheduler (libdispatch, Windows pool, portable).

Maps to the OS thread pool when the platform provides one; otherwise uses the library's portable implementation. Common configurations include Apple (Grand Central Dispatch), Windows thread pools, and Emscripten/WebAssembly builds per STLAB_TASK_SYSTEM.

Submit work through high_executor, default_executor, or low_executor as priority hints; the runtime prefers high, then default, then low, but order is not strict under load.

Note
Call pre_exit() before normal process exit when using these executors so detached tasks do not overlap teardown of globals or other exit handlers (the implementation registers a pre-exit hook). std::quick_exit() is an alternative when it fits your program.