|
ThreadSchedule 3.0.0
Modern C++ thread management library
|
Per-thread control handle for OS-level scheduling operations. More...
#include <thread_control_block.hpp>
Public Member Functions | |
| thread_control_block ()=default | |
| thread_control_block (thread_control_block const &)=delete | |
| auto | operator= (thread_control_block const &) -> thread_control_block &=delete |
| thread_control_block (thread_control_block &&)=delete | |
| auto | operator= (thread_control_block &&) -> thread_control_block &=delete |
| ~thread_control_block ()=default | |
| auto | tid () const noexcept -> native_thread_id |
| auto | std_id () const noexcept -> std::thread::id |
| auto | set_affinity (native_thread_affinity const &affinity) const -> expected< void, std::error_code > |
| auto | set_priority (native_thread_priority priority) const -> expected< void, std::error_code > |
| auto | set_nice_value (int nice_value) const -> expected< void, std::error_code > |
| auto | get_nice_value () const -> expected< int, std::error_code > |
| auto | set_scheduling_policy (native_scheduling_policy policy, native_thread_priority priority) const -> expected< void, std::error_code > |
| auto | configure (native_scheduling_config const &config) const -> expected< void, std::error_code > |
| auto | set_name (std::string const &name) const -> expected< void, std::error_code > |
Static Public Member Functions | |
| static auto | create_for_current_thread () -> std::shared_ptr< thread_control_block > |
Friends | |
| class | thread_registry_backend |
Per-thread control handle for OS-level scheduling operations.
A thread_control_block captures the native thread handle (pthread_t on Linux, a duplicated HANDLE on Windows) at construction time and exposes cross-platform methods to modify the thread's affinity, priority, scheduling policy, and OS-visible name.
pthread_self() / GetCurrentThread().std::shared_ptr so that the registry, the owning thread, and any observers can all share the same instance. The static factory already returns a shared_ptr.set_* methods are safe to call from any thread - they operate on the stored native handle, not on thread-local state.set_* methods on the same instance are safe (each call is a single OS syscall on the stored handle).std::errc::no_such_process.pthread_t obtained via pthread_self(). No resource is owned; the handle is valid for the lifetime of the thread.GetCurrentThread() into a real HANDLE with THREAD_SET_INFORMATION | THREAD_QUERY_INFORMATION rights. The duplicated handle is closed in the destructor.set_name() enforces the 15-character POSIX limit and returns std::errc::invalid_argument if exceeded. Definition at line 121 of file thread_control_block.hpp.
|
default |
|
delete |
|
delete |
|
default |
|
inline |
Definition at line 222 of file thread_control_block.hpp.
References threadschedule::detail::apply_scheduling_config().
|
inlinestatic |
Definition at line 248 of file thread_control_block.hpp.
References threadschedule::detail::thread_info::get_thread_id(), and threadschedule::detail::read_thread_start_time().
Referenced by threadschedule::detail::registration_guard_backend::registration_guard_backend(), and threadschedule::detail::registration_guard_backend::registration_guard_backend().
|
inline |
Definition at line 195 of file thread_control_block.hpp.
References threadschedule::detail::read_effective_nice().
|
delete |
|
delete |
|
inline |
Definition at line 156 of file thread_control_block.hpp.
References threadschedule::detail::apply_affinity_checked().
|
inline |
Definition at line 235 of file thread_control_block.hpp.
|
inline |
Definition at line 182 of file thread_control_block.hpp.
|
inline |
Definition at line 169 of file thread_control_block.hpp.
References threadschedule::detail::apply_scheduling_config(), and threadschedule::detail::native_schedule::posix_nice().
|
inline |
Definition at line 208 of file thread_control_block.hpp.
|
inlinenoexcept |
Definition at line 138 of file thread_control_block.hpp.
|
inlinenoexcept |
Definition at line 133 of file thread_control_block.hpp.
|
friend |
Definition at line 327 of file thread_control_block.hpp.