|
ThreadSchedule 3.0.0
Modern C++ thread management library
|
Lightweight handle for querying and controlling a specific OS thread. More...
#include <thread_backend.hpp>
Public Types | |
| using | native_handle_type = pthread_t |
Public Member Functions | |
| thread_info () | |
| thread_info (native_thread_id tid) | |
| auto | thread_id () const noexcept -> native_thread_id |
| auto | set_name (std::string const &name) const -> expected< void, std::error_code > |
| auto | get_name () const -> expected< std::string, std::error_code > |
| auto | set_priority (native_thread_priority priority) const -> expected< void, 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 | configure (native_thread_config const &config) const -> expected< void, std::error_code > |
| auto | set_affinity (native_thread_affinity const &affinity) const -> expected< void, std::error_code > |
| auto | get_affinity () const -> expected< native_thread_affinity, std::error_code > |
| auto | get_policy () const -> std::optional< native_scheduling_policy > |
| auto | get_priority () const -> std::optional< int > |
Static Public Member Functions | |
| static auto | hardware_concurrency () -> unsigned int |
| static auto | get_thread_id () -> native_thread_id |
| static auto | get_current_policy () -> std::optional< native_scheduling_policy > |
| static auto | get_current_priority () -> std::optional< int > |
Lightweight handle for querying and controlling a specific OS thread.
The default constructor binds to the current thread. The explicit constructor binds to a caller-provided OS thread ID (native_thread_id), allowing callers to act on library-owned background threads or any other live thread in the process.
hardware_concurrency() - delegates to std::thread::hardware_concurrency().get_thread_id() - returns the OS-level thread ID (Linux TID via syscall(SYS_gettid), Windows thread ID via GetCurrentThreadId()).set_name, get_name, set_priority, set_scheduling_policy, set_affinity, get_affinity, get_policy, and get_priority for the bound thread ID.get_current_policy() / get_current_priority() remain as compatibility conveniences for the current thread.Definition at line 645 of file thread_backend.hpp.
| using threadschedule::detail::thread_info::native_handle_type = pthread_t |
Definition at line 651 of file thread_backend.hpp.
|
inline |
Definition at line 654 of file thread_backend.hpp.
Referenced by get_current_policy(), and get_current_priority().
|
inlineexplicit |
Definition at line 659 of file thread_backend.hpp.
|
inline |
Definition at line 708 of file thread_backend.hpp.
References threadschedule::detail::apply_scheduling_config().
|
inline |
Definition at line 716 of file thread_backend.hpp.
References threadschedule::detail::configure_thread().
|
inline |
Definition at line 730 of file thread_backend.hpp.
Referenced by threadschedule::detail::distribute_workers_across_cpus().
|
inlinestatic |
Definition at line 770 of file thread_backend.hpp.
References thread_info().
|
inlinestatic |
Definition at line 776 of file thread_backend.hpp.
References thread_info().
|
inline |
Definition at line 676 of file thread_backend.hpp.
Referenced by threadschedule::this_thread::get_name().
|
inline |
Definition at line 738 of file thread_backend.hpp.
|
inline |
Definition at line 746 of file thread_backend.hpp.
|
inlinestatic |
Definition at line 760 of file thread_backend.hpp.
Referenced by threadschedule::detail::thread_control_block::create_for_current_thread(), threadschedule::detail::thread_registry_backend::register_current_thread(), threadschedule::detail::scheduled_pool_backend_base< PoolType >::scheduler_thread_info(), and threadschedule::detail::thread_registry_backend::unregister_current_thread().
|
inlinestatic |
Definition at line 754 of file thread_backend.hpp.
|
inline |
Definition at line 722 of file thread_backend.hpp.
References threadschedule::detail::apply_affinity_checked().
|
inline |
Definition at line 668 of file thread_backend.hpp.
Referenced by threadschedule::this_thread::set_name().
|
inline |
Definition at line 684 of file thread_backend.hpp.
References threadschedule::detail::apply_scheduling_config(), and threadschedule::detail::native_schedule::posix_nice().
|
inline |
Definition at line 699 of file thread_backend.hpp.
|
inlinenoexcept |
Definition at line 662 of file thread_backend.hpp.