|
ThreadSchedule 2.0.0
Modern C++ thread management library
|
Looks up an OS thread by its name via /proc and provides scheduling control. More...
#include <thread_wrapper.hpp>
Public Types | |
| using | native_handle_type = pid_t |
Public Member Functions | |
| ThreadByNameView (const std::string &name) | |
| auto | found () const noexcept -> bool |
| auto | set_name (std::string const &name) const -> expected< void, std::error_code > |
| auto | get_name () const -> std::optional< std::string > |
| auto | native_handle () const noexcept -> native_handle_type |
| 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_affinity (ThreadAffinity const &affinity) const -> expected< void, std::error_code > |
Looks up an OS thread by its name via /proc and provides scheduling control.
On construction, scans /proc/self/task/ to find a thread whose comm matches the given name. If found, the Linux TID is cached and subsequent calls operate on that TID via sched_setscheduler / sched_setaffinity (TID-based syscalls, not pthread_setschedparam).
errc::function_not_supported, and found() always returns false.sched_setscheduler(tid, ...) rather than pthread_setschedparam(). Changing real-time policies may require CAP_SYS_NICE.Definition at line 668 of file thread_wrapper.hpp.
| using threadschedule::ThreadByNameView::native_handle_type = pid_t |
Definition at line 674 of file thread_wrapper.hpp.
|
inlineexplicit |
Definition at line 677 of file thread_wrapper.hpp.
|
inlinenodiscardnoexcept |
Definition at line 710 of file thread_wrapper.hpp.
Referenced by get_name(), set_affinity(), set_name(), set_priority(), and set_scheduling_policy().
|
inlinenodiscard |
Definition at line 740 of file thread_wrapper.hpp.
References found().
|
inlinenodiscardnoexcept |
Definition at line 759 of file thread_wrapper.hpp.
|
inlinenodiscard |
Definition at line 787 of file thread_wrapper.hpp.
References threadschedule::detail::apply_affinity(), and found().
|
inlinenodiscard |
Definition at line 719 of file thread_wrapper.hpp.
References found().
|
inlinenodiscard |
Definition at line 764 of file thread_wrapper.hpp.
References threadschedule::detail::apply_priority(), and found().
|
inlinenodiscard |
Definition at line 775 of file thread_wrapper.hpp.
References threadschedule::detail::apply_scheduling_policy(), and found().