|
ThreadSchedule 3.0.0
Modern C++ thread management library
|
Non-owning control view found by an exact process-thread name. More...
#include <thread_by_name_view.hpp>
Public Member Functions | |
| thread_by_name_view (std::string_view name) | |
Find exactly one process thread with name. | |
| auto | alive () const noexcept -> bool |
| Return whether the original native thread identity is still live. | |
| auto | native_id () const noexcept -> native_thread_id |
| Return the platform-native process thread ID. | |
| auto | configure (thread_config const &config) -> result< void > |
| Apply a portable thread configuration to the target. | |
| auto | set_priority (priority_level level) -> result< void > |
| Set a portable priority preset on the target. | |
| auto | set_nice (nice_value value) -> result< void > |
| Set an explicit nice value on the target. | |
| auto | get_priority () const -> result< priority_level > |
| Query the effective portable priority preset. | |
| auto | get_nice () const -> result< nice_value > |
| Query the effective nice value. | |
| auto | set_name (std::string const &name) -> result< void > |
| Set the OS-visible target name without changing view identity. | |
| auto | get_name () const -> result< std::string > |
| Query the current OS-visible target name. | |
| auto | set_affinity (thread_affinity const &affinity) -> result< void > |
| Set target CPU affinity with exact readback and rollback. | |
| auto | get_affinity () const -> result< thread_affinity > |
| Query target CPU affinity. | |
Static Public Member Functions | |
| static auto | create (std::string_view name) -> result< thread_by_name_view > |
| Find exactly one named process thread without throwing. | |
| static auto | find_all (std::string_view name) -> result< std::vector< thread_by_name_view > > |
| Return every exact name match ordered by native thread ID. | |
Non-owning control view found by an exact process-thread name.
Linux lookup scans /proc/self/task and compares the kernel-visible comm name exactly. A view stores both the native thread ID and the thread start time, so an exited thread or a recycled ID is rejected with std::errc::no_such_process.
Lookup is snapshot-based. Renaming the target does not retarget an existing view, and a matching thread created after lookup does not affect it.
Definition at line 39 of file thread_by_name_view.hpp.
|
inlineexplicit |
Find exactly one process thread with name.
| std::system_error | for no match, ambiguous matches, invalid input, or an unsupported platform. |
Definition at line 47 of file thread_by_name_view.hpp.
|
inlinenoexcept |
Return whether the original native thread identity is still live.
Definition at line 87 of file thread_by_name_view.hpp.
References threadschedule::detail::native_thread_is_alive().
|
inline |
Apply a portable thread configuration to the target.
Definition at line 101 of file thread_by_name_view.hpp.
References threadschedule::detail::apply_affinity_checked(), threadschedule::detail::apply_scheduling_config(), set_name(), threadschedule::detail::to_native(), and threadschedule::detail::try_result().
|
inlinestatic |
Find exactly one named process thread without throwing.
Definition at line 51 of file thread_by_name_view.hpp.
References threadschedule::detail::try_result().
|
inlinestatic |
Return every exact name match ordered by native thread ID.
Definition at line 68 of file thread_by_name_view.hpp.
References threadschedule::detail::find_native_threads_by_name(), and threadschedule::detail::try_result().
|
inline |
Query target CPU affinity.
Definition at line 194 of file thread_by_name_view.hpp.
|
inline |
Query the current OS-visible target name.
Definition at line 175 of file thread_by_name_view.hpp.
|
inline |
Query the effective nice value.
Definition at line 160 of file thread_by_name_view.hpp.
References threadschedule::detail::read_effective_nice().
|
inline |
Query the effective portable priority preset.
Definition at line 152 of file thread_by_name_view.hpp.
References threadschedule::detail::read_effective_nice().
|
inlinenoexcept |
Return the platform-native process thread ID.
Definition at line 94 of file thread_by_name_view.hpp.
References threadschedule::detail::native_thread_identity::id.
|
inline |
Set target CPU affinity with exact readback and rollback.
Definition at line 182 of file thread_by_name_view.hpp.
References threadschedule::detail::apply_affinity_checked(), threadschedule::detail::to_native(), and threadschedule::detail::try_result().
|
inline |
Set the OS-visible target name without changing view identity.
Definition at line 168 of file thread_by_name_view.hpp.
Referenced by configure().
|
inline |
Set an explicit nice value on the target.
Definition at line 143 of file thread_by_name_view.hpp.
References threadschedule::detail::apply_scheduling_config(), and threadschedule::detail::native_schedule::posix_nice().
|
inline |
Set a portable priority preset on the target.
Definition at line 131 of file thread_by_name_view.hpp.
References threadschedule::detail::apply_scheduling_config(), and threadschedule::detail::native_schedule::posix_nice().