|
execution 1.0.1
Portable task execution, timers, and process lifecycle
|
Move-only callable wrapper for executor scheduling (task<Signature>). More...
#include <algorithm>#include <array>#include <cstddef>#include <exception>#include <functional>#include <memory>#include <type_traits>#include <utility>#include <stlab/execution/config.hpp>Go to the source code of this file.
Classes | |
| struct | stlab::stlab_v2_task_concept |
| Versioned operation table used to relocate a task target across the shared executor ABI. More... | |
| class | stlab::task_< NoExcept, R, Args > |
| Type-erased, move-only callable with signature R(Args...) (or noexcept variant). More... | |
| struct | stlab::noexcept_deducer< T, R(Args...)> |
| struct | stlab::noexcept_deducer< T, R(Args...) noexcept > |
Typedefs | |
| template<class F> | |
| using | stlab::task |
| task_ with noexcept deduced from the function type F (e.g. void() vs void() noexcept). | |
Variables | |
| constexpr std::size_t | stlab::stlab_v2_task_storage_size |
| Number of bytes reserved for a v2 task's relocatable inline model. | |
| constexpr std::size_t | stlab::stlab_v2_task_storage_alignment |
| Alignment required by a v2 task's relocatable inline model. | |
Move-only callable wrapper for executor scheduling (task<Signature>).
task<F> type-erases callable targets (functions, lambdas, member pointers, std::bind expressions, etc.) using std::invoke with a fixed signature. It is similar to std::function but not copyable, which suits move-only and single-shot targets (common in messaging and executor queues). An empty task compares equal to nullptr; invoking it throws std::bad_function_call for a potentially throwing signature, or calls std::terminate() for a noexcept signature.
Member pointers take their object as the first argument, as with std::invoke. Mutable operator() allows moving arguments through for one invocation. Small targets with non-throwing move construction may use small-buffer optimization; other targets are heap-allocated so task relocation remains non-throwing.
Queued-target requirement: callable construction (including copy/move construction) and destruction of moved-from callables must not submit work to executors or timers. These operations may run while a queue is locked. Submission from the task body and destruction of its executed target is supported.