|
ThreadSchedule 2.0.0
Modern C++ thread management library
|
Per-thread control handle for OS-level scheduling operations. More...
#include <thread_registry.hpp>
Public Member Functions | |
| ThreadControlBlock ()=default | |
| ThreadControlBlock (ThreadControlBlock const &)=delete | |
| auto | operator= (ThreadControlBlock const &) -> ThreadControlBlock &=delete |
| ThreadControlBlock (ThreadControlBlock &&)=delete | |
| auto | operator= (ThreadControlBlock &&) -> ThreadControlBlock &=delete |
| ~ThreadControlBlock () | |
| auto | tid () const noexcept -> Tid |
| auto | std_id () const noexcept -> std::thread::id |
| auto | set_affinity (ThreadAffinity const &affinity) const -> expected< void, std::error_code > |
| auto | set_priority (ThreadPriority priority) const -> expected< void, std::error_code > |
| auto | set_scheduling_policy (SchedulingPolicy policy, ThreadPriority priority) 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< ThreadControlBlock > |
Per-thread control handle for OS-level scheduling operations.
A ThreadControlBlock 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).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 134 of file thread_registry.hpp.
|
default |
Referenced by operator=(), operator=(), ThreadControlBlock(), and ThreadControlBlock().
|
delete |
References ThreadControlBlock().
|
delete |
References ThreadControlBlock().
|
inline |
Definition at line 143 of file thread_registry.hpp.
|
inlinestatic |
Definition at line 194 of file thread_registry.hpp.
References threadschedule::ThreadInfo::get_thread_id().
Referenced by threadschedule::AutoRegisterCurrentThread::AutoRegisterCurrentThread(), and threadschedule::AutoRegisterCurrentThread::AutoRegisterCurrentThread().
|
delete |
References ThreadControlBlock().
|
delete |
References ThreadControlBlock().
|
inlinenodiscard |
Definition at line 173 of file thread_registry.hpp.
References threadschedule::detail::apply_affinity().
|
inlinenodiscard |
Definition at line 189 of file thread_registry.hpp.
References threadschedule::detail::apply_name().
|
inlinenodiscard |
Definition at line 178 of file thread_registry.hpp.
References threadschedule::detail::apply_priority().
|
inlinenodiscard |
Definition at line 183 of file thread_registry.hpp.
References threadschedule::detail::apply_scheduling_policy().
|
inlinenodiscardnoexcept |
Definition at line 158 of file thread_registry.hpp.
|
inlinenodiscardnoexcept |
Definition at line 154 of file thread_registry.hpp.