ThreadSchedule 4.1.0
Modern C++ thread management library
Loading...
Searching...
No Matches
threadschedule Namespace Reference

Namespaces

namespace  advanced
namespace  detail
 Aggregates multiple thread_registry_backend instances into a single queryable view.
namespace  schedule
 Helpers for building scheduling_config values.
namespace  this_thread
 Portable configuration operations for the calling thread.

Classes

class  cpu_id
 Validated CPU identifier. More...
struct  unexpect_t
class  bad_expected_access
class  unexpected
class  expected
class  expected< void, E >
class  expected< const void, E >
class  expected< volatile void, E >
class  expected< const volatile void, E >
class  nice_value
 Strongly-typed nice value in the POSIX range $[-20, 19]$. More...
struct  pool_statistics
 Snapshot of pool activity metrics. More...
class  realtime_priority
 Strongly-typed realtime priority in the range $[1, 99]$. More...
class  scheduled_pool_config
 Builder-style configuration for scheduled_pool. More...
class  scheduled_pool
 Scheduler that executes delayed and periodic tasks on worker threads. More...
class  scheduled_task
class  scheduling_config
 Immutable scheduling request passed to thread creation/configuration APIs. More...
struct  task_error
 Captured information about a task failure. More...
class  thread
 Owning thread wrapper with result-based lifecycle/configuration API. More...
class  thread_affinity
class  thread_config
 Portable thread configuration bundle. More...
class  thread_id
class  thread_pool_config
 Builder-style configuration for thread_pool. More...
class  thread_pool
 Fixed-size thread pool for queued asynchronous work. More...
struct  registered_thread
 Snapshot entry returned by thread_registry::snapshot. More...
class  thread_registry
 Registry for named/configurable threads. More...
class  global_registry_binding
 Temporarily bind an owning registry as the global external registry. More...
class  auto_register_current_thread
 RAII registration of the calling thread in a portable registry. More...
class  thread_view
 Non-owning view over a running thread or jthread. More...
class  worker_count
 Value type for pool worker count. More...

Typedefs

template<typename T>
using result = expected<T, std::error_code>
 Standard result type used by public APIs.
using error_callback = std::function<void(task_error const&)>
 Callback signature for asynchronous task error reporting.

Enumerations

enum class  build_mode : std::uint8_t { header_only , runtime }
 Describes whether ThreadSchedule uses inline storage or its shared runtime. More...
enum class  scheduling_intent : std::uint8_t {
  background , normal , interactive , low_latency ,
  realtime_fifo , realtime_round_robin , nice
}
 Portable scheduling intents that map to platform-specific behavior. More...
enum class  priority_level : std::int8_t {
  lowest = 19 , low = 5 , normal = 0 , high = -5 ,
  highest = -20
}
 Portable non-realtime priority levels. More...
enum class  shutdown_policy : std::uint8_t { drain , drop_pending }
 Defines how pools handle pending work during shutdown. More...
enum class  worker_registration : std::uint8_t { disabled , global_registry }
 Controls whether pool workers are registered in a thread registry. More...

Functions

template<typename E>
 unexpected (E) -> unexpected< E >
template<typename T, typename E, typename T2, std::enable_if_t<!detail::is_expected_v< T2 > &&!detail::is_unexpected_v< T2 > &&!std::is_void_v< T >, int > = 0, std::enable_if_t< detail::expected_equality_comparable_v< T, T2 >, int > = 0>
constexpr auto operator== (expected< T, E > const &lhs, T2 const &rhs) -> bool
template<typename T, typename E, typename T2, std::enable_if_t<!detail::is_expected_v< T2 > &&!detail::is_unexpected_v< T2 > &&!std::is_void_v< T >, int > = 0, std::enable_if_t< detail::expected_equality_comparable_v< T, T2 >, int > = 0>
constexpr auto operator== (T2 const &lhs, expected< T, E > const &rhs) -> bool
template<typename T, typename E, typename T2, std::enable_if_t<!detail::is_expected_v< T2 > &&!detail::is_unexpected_v< T2 > &&!std::is_void_v< T >, int > = 0, std::enable_if_t< detail::expected_equality_comparable_v< T, T2 >, int > = 0>
constexpr auto operator!= (expected< T, E > const &lhs, T2 const &rhs) -> bool
template<typename T, typename E, typename T2, std::enable_if_t<!detail::is_expected_v< T2 > &&!detail::is_unexpected_v< T2 > &&!std::is_void_v< T >, int > = 0, std::enable_if_t< detail::expected_equality_comparable_v< T, T2 >, int > = 0>
constexpr auto operator!= (T2 const &lhs, expected< T, E > const &rhs) -> bool
template<typename T, typename E>
constexpr auto swap (expected< T, E > &lhs, expected< T, E > &rhs) noexcept(noexcept(lhs.swap(rhs))) -> decltype(lhs.swap(rhs))
constexpr auto current_build_mode () noexcept -> build_mode
constexpr auto build_mode_string () noexcept -> char const *
auto global_registry () ->thread_registry &

Variables

constexpr unexpect_t unexpect {}
constexpr bool is_runtime_build = false

Typedef Documentation

◆ error_callback

using threadschedule::error_callback = std::function<void(task_error const&)>

Callback signature for asynchronous task error reporting.

Definition at line 78 of file task_error.hpp.

◆ result

template<typename T>
using threadschedule::result = expected<T, std::error_code>

Standard result type used by public APIs.

Template Parameters
TValue type on success.

On failure the error channel contains std::error_code.

Definition at line 22 of file result.hpp.

Enumeration Type Documentation

◆ build_mode

enum class threadschedule::build_mode : std::uint8_t
strong

Describes whether ThreadSchedule uses inline storage or its shared runtime.

Enumerator
header_only 

Header-only mode: implementation is compiled into each translation unit.

runtime 

Runtime mode: implementation is provided by the shared runtime library.

Definition at line 16 of file runtime.hpp.

◆ priority_level

enum class threadschedule::priority_level : std::int8_t
strong

Portable non-realtime priority levels.

Enumerator
lowest 
low 
normal 
high 
highest 

Definition at line 43 of file scheduling.hpp.

◆ scheduling_intent

enum class threadschedule::scheduling_intent : std::uint8_t
strong

Portable scheduling intents that map to platform-specific behavior.

Enumerator
background 

Prefer throughput and lower CPU contention over responsiveness.

normal 

Default scheduler behavior with balanced responsiveness.

interactive 

Favor responsiveness for user-facing work.

low_latency 

Favor low-latency execution where possible.

realtime_fifo 

Request POSIX FIFO realtime scheduling.

realtime_round_robin 

Request POSIX round-robin realtime scheduling.

nice 

Apply an explicit nice-level priority value.

Definition at line 24 of file scheduling.hpp.

◆ shutdown_policy

enum class threadschedule::shutdown_policy : std::uint8_t
strong

Defines how pools handle pending work during shutdown.

Enumerator
drain 

Finish queued work before returning from shutdown.

drop_pending 

Cancel/drop queued work that has not started yet.

Definition at line 16 of file shutdown_policy.hpp.

◆ worker_registration

enum class threadschedule::worker_registration : std::uint8_t
strong

Controls whether pool workers are registered in a thread registry.

Enumerator
disabled 

Do not register workers in the global registry.

global_registry 

Register workers in the global registry for discovery/control.

Definition at line 16 of file worker_registration.hpp.

Function Documentation

◆ build_mode_string()

auto threadschedule::build_mode_string ( ) ->charconst *
inlinenodiscardconstexprnoexcept

Definition at line 38 of file runtime.hpp.

References is_runtime_build.

◆ current_build_mode()

auto threadschedule::current_build_mode ( ) ->build_mode
inlinenodiscardconstexprnoexcept

Definition at line 31 of file runtime.hpp.

References header_only.

◆ global_registry()

◆ operator!=() [1/2]

template<typename T, typename E, typename T2, std::enable_if_t<!detail::is_expected_v< T2 > &&!detail::is_unexpected_v< T2 > &&!std::is_void_v< T >, int > = 0, std::enable_if_t< detail::expected_equality_comparable_v< T, T2 >, int > = 0>
auto threadschedule::operator!= ( expected< T, E > const & lhs,
T2 const & rhs )->bool
constexpr

Definition at line 1819 of file expected.hpp.

◆ operator!=() [2/2]

template<typename T, typename E, typename T2, std::enable_if_t<!detail::is_expected_v< T2 > &&!detail::is_unexpected_v< T2 > &&!std::is_void_v< T >, int > = 0, std::enable_if_t< detail::expected_equality_comparable_v< T, T2 >, int > = 0>
auto threadschedule::operator!= ( T2 const & lhs,
expected< T, E > const & rhs )->bool
constexpr

Definition at line 1827 of file expected.hpp.

◆ operator==() [1/2]

template<typename T, typename E, typename T2, std::enable_if_t<!detail::is_expected_v< T2 > &&!detail::is_unexpected_v< T2 > &&!std::is_void_v< T >, int > = 0, std::enable_if_t< detail::expected_equality_comparable_v< T, T2 >, int > = 0>
auto threadschedule::operator== ( expected< T, E > const & lhs,
T2 const & rhs )->bool
constexpr

Definition at line 1801 of file expected.hpp.

◆ operator==() [2/2]

template<typename T, typename E, typename T2, std::enable_if_t<!detail::is_expected_v< T2 > &&!detail::is_unexpected_v< T2 > &&!std::is_void_v< T >, int > = 0, std::enable_if_t< detail::expected_equality_comparable_v< T, T2 >, int > = 0>
auto threadschedule::operator== ( T2 const & lhs,
expected< T, E > const & rhs )->bool
constexpr

Definition at line 1811 of file expected.hpp.

◆ swap()

template<typename T, typename E>
auto threadschedule::swap ( expected< T, E > & lhs,
expected< T, E > & rhs )->decltype(lhs.swap(rhs))
constexprnoexcept

Definition at line 1834 of file expected.hpp.

◆ unexpected()

template<typename E>
threadschedule::unexpected ( E ) ->unexpected< E >

Referenced by threadschedule::detail::apply_affinity_checked(), threadschedule::detail::apply_scheduling_config(), threadschedule::advanced::cgroup_attach_tid(), threadschedule::detail::checked_deadline_after(), threadschedule::detail::checked_duration_cast(), threadschedule::detail::thread_registry_backend::configure(), threadschedule::detail::thread_registry_backend::configure(), threadschedule::thread_registry::configure(), threadschedule::detail::scheduled_pool_facade<::threadschedule::detail::scheduled_pool_backend >::configure_scheduler(), threadschedule::detail::scheduled_pool_backend_base< thread_pool_backend >::configure_scheduler_thread(), threadschedule::detail::scheduled_pool_backend_base< thread_pool_backend >::configure_scheduler_thread(), threadschedule::advanced::chaos_controller::configure_thread(), threadschedule::detail::configure_thread(), threadschedule::detail::configure_thread(), threadschedule::detail::configure_worker_threads(), threadschedule::detail::configure_worker_threads(), threadschedule::detail::lightweight_pool_facade<::threadschedule::detail::lightweight_pool_backend >::configure_workers(), threadschedule::detail::scheduled_pool_facade<::threadschedule::detail::scheduled_pool_backend >::configure_workers(), threadschedule::detail::submitting_pool_facade<::threadschedule::detail::polling_pool_backend >::configure_workers(), threadschedule::thread_pool::configure_workers(), threadschedule::advanced::thread_by_name_view::create(), threadschedule::cpu_id::create(), threadschedule::nice_value::create(), threadschedule::realtime_priority::create(), threadschedule::thread_id::create(), threadschedule::worker_count::create(), threadschedule::detail::scheduler_parameters::create_for_policy(), threadschedule::detail::thread_lifecycle::detach(), threadschedule::detail::lightweight_pool_facade<::threadschedule::detail::lightweight_pool_backend >::distribute_workers(), threadschedule::detail::submitting_pool_facade<::threadschedule::detail::polling_pool_backend >::distribute_workers(), threadschedule::detail::distribute_workers_across_cpus(), threadschedule::advanced::thread_by_name_view::find_all(), threadschedule::detail::find_native_threads_by_name(), threadschedule::detail::portable_thread_control::get_affinity(), threadschedule::detail::portable_thread_control::get_nice(), threadschedule::thread_registry::get_nice(), threadschedule::detail::thread_registry_backend::get_nice_value(), threadschedule::detail::portable_thread_control::get_priority(), threadschedule::thread_registry::get_priority(), threadschedule::detail::scheduler_parameters::get_priority_range(), threadschedule::detail::thread_lifecycle::join(), threadschedule::advanced::native_id(), threadschedule::detail::basic_thread_backend< ThreadType, OwnershipTag >::no_such_thread(), threadschedule::detail::submitting_pool_facade<::threadschedule::detail::polling_pool_backend >::parallel_for_each(), threadschedule::detail::lightweight_pool_facade<::threadschedule::detail::lightweight_pool_backend >::post(), threadschedule::detail::submitting_pool_facade<::threadschedule::detail::polling_pool_backend >::post(), threadschedule::thread_pool::post(), threadschedule::detail::read_effective_nice(), threadschedule::detail::scheduled_pool_facade<::threadschedule::detail::scheduled_pool_backend >::schedule_after(), threadschedule::scheduled_pool::schedule_after(), threadschedule::detail::scheduled_pool_facade<::threadschedule::detail::scheduled_pool_backend >::schedule_at(), threadschedule::scheduled_pool::schedule_at(), threadschedule::detail::scheduled_pool_facade<::threadschedule::detail::scheduled_pool_backend >::schedule_periodic(), threadschedule::scheduled_pool::schedule_periodic(), threadschedule::detail::scheduled_pool_facade<::threadschedule::detail::scheduled_pool_backend >::schedule_periodic_after(), threadschedule::scheduled_pool::schedule_periodic_after(), threadschedule::detail::thread_registry_backend::set_affinity(), threadschedule::detail::thread_registry_backend::set_name(), threadschedule::thread_registry::set_nice(), threadschedule::detail::basic_thread_backend< ThreadType, OwnershipTag >::set_nice_value(), threadschedule::detail::thread_registry_backend::set_nice_value(), threadschedule::detail::thread_registry_backend::set_priority(), threadschedule::detail::thread_registry_backend::set_scheduling_policy(), threadschedule::detail::set_worker_affinity(), threadschedule::detail::submitting_pool_facade<::threadschedule::detail::polling_pool_backend >::submit(), threadschedule::thread_pool::submit(), threadschedule::detail::submitting_pool_facade<::threadschedule::detail::polling_pool_backend >::submit_batch(), threadschedule::detail::inline_pool_backend::try_post(), threadschedule::detail::lightweight_pool_backend_base< TaskSize >::try_post(), threadschedule::detail::thread_pool_backend_base< indefinite_wait >::try_post(), threadschedule::detail::work_stealing_pool_backend::try_post(), threadschedule::detail::lightweight_pool_backend_base< TaskSize >::try_post_batch(), threadschedule::detail::try_result(), threadschedule::detail::inline_pool_backend::try_submit(), threadschedule::detail::thread_pool_backend_base< indefinite_wait >::try_submit(), threadschedule::detail::work_stealing_pool_backend::try_submit(), threadschedule::detail::inline_pool_backend::try_submit_batch(), threadschedule::detail::thread_pool_backend_base< indefinite_wait >::try_submit_batch(), threadschedule::detail::work_stealing_pool_backend::try_submit_batch(), threadschedule::thread_registry::unregister_current_thread(), threadschedule::detail::submitting_pool_facade<::threadschedule::detail::polling_pool_backend >::wait(), threadschedule::thread_pool::wait(), threadschedule::advanced::when_all_settled(), and threadschedule::advanced::when_all_settled().

Variable Documentation

◆ is_runtime_build

bool threadschedule::is_runtime_build = false
inlineconstexpr

Definition at line 28 of file runtime.hpp.

Referenced by build_mode_string().

◆ unexpect

unexpect_t threadschedule::unexpect {}
inlineconstexpr

Definition at line 53 of file expected.hpp.