ThreadSchedule 2.0.0
Modern C++ thread management library
Loading...
Searching...
No Matches
profiles.hpp File Reference

High-level thread configuration profiles and helpers. More...

#include "concepts.hpp"
#include "scheduler_policy.hpp"
#include "thread_pool.hpp"
#include "thread_registry.hpp"
#include <optional>
#include <string>
Include dependency graph for profiles.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  threadschedule::is_thread_like< ThreadWrapper >
struct  threadschedule::is_thread_like< ThreadWrapperView >
struct  threadschedule::ThreadProfile
 Declarative profile bundling scheduling intent for a thread. More...

Namespaces

namespace  threadschedule
namespace  threadschedule::profiles
namespace  threadschedule::detail

Functions

auto threadschedule::profiles::realtime () -> ThreadProfile
 Highest priority profile. Uses FIFO on Linux (if permitted), falls back to OTHER on Windows.
auto threadschedule::profiles::low_latency () -> ThreadProfile
 Low-latency interactive profile using RR scheduling.
auto threadschedule::profiles::throughput () -> ThreadProfile
 Throughput-oriented profile favoring batch scheduling.
auto threadschedule::profiles::background () -> ThreadProfile
 Background profile for very low priority work.
template<typename T>
auto threadschedule::detail::apply_profile_to (T &t, ThreadProfile const &p) -> expected< void, std::error_code >
 Apply policy + optional affinity to any type exposing set_scheduling_policy() and set_affinity().
template<typename PoolType>
auto threadschedule::detail::apply_profile_to_pool (PoolType &pool, std::string const &name_prefix, ThreadProfile const &p) -> expected< void, std::error_code >
 Apply configure_threads + optional affinity to any pool type.
template<typename ThreadLike, std::enable_if_t< is_thread_like_v< ThreadLike >, int > = 0>
auto threadschedule::apply_profile (ThreadLike &t, ThreadProfile const &p) -> expected< void, std::error_code >
 Apply a profile to a thread wrapper or view.
auto threadschedule::apply_profile (ThreadControlBlock &t, ThreadProfile const &p) -> expected< void, std::error_code >
 Apply a profile to a ThreadControlBlock directly.
auto threadschedule::apply_profile (RegisteredThreadInfo &t, ThreadProfile const &p) -> expected< void, std::error_code >
 Apply a profile to a registered thread via its info record.
auto threadschedule::apply_profile (ThreadPool &pool, ThreadProfile const &p) -> expected< void, std::error_code >
 Apply a profile to every worker in a ThreadPool.
auto threadschedule::apply_profile (FastThreadPool &pool, ThreadProfile const &p) -> expected< void, std::error_code >
 Apply a profile to every worker in a FastThreadPool.
auto threadschedule::apply_profile (HighPerformancePool &pool, ThreadProfile const &p) -> expected< void, std::error_code >
 Apply a profile to every worker in a HighPerformancePool.
auto threadschedule::apply_profile (ThreadRegistry &reg, Tid tid, ThreadProfile const &p) -> expected< void, std::error_code >
 Apply a profile to a registry-managed thread identified by TID.

Detailed Description

High-level thread configuration profiles and helpers.

Provides simple presets (e.g. realtime, low_latency, throughput, background) and utility functions to apply them to single threads, thread pools, or registry-managed threads. Profiles abstract low-level flags like policy, priority, and optional CPU affinity into a single intent.

Definition in file profiles.hpp.