ThreadSchedule 4.1.0
Modern C++ thread management library
Loading...
Searching...
No Matches
threadschedule::thread_registry Class Reference

Registry for named/configurable threads. More...

#include <thread_registry.hpp>

Public Member Functions

 thread_registry ()
 Construct an owning registry instance.
 thread_registry (thread_registry &&) noexcept=default
auto operator= (thread_registry &&other) -> thread_registry &
 thread_registry (thread_registry const &)=delete
auto operator= (thread_registry const &) -> thread_registry &=delete
auto register_current_thread (std::string name={}, std::string component={}) -> result< void >
 Register the calling thread.
auto unregister_current_thread () -> result< void >
 Unregister the calling thread.
auto count () const -> std::size_t
 Return number of tracked entries.
auto empty () const -> bool
 Return whether registry has no tracked entries.
auto snapshot () const -> result< std::vector< registered_thread > >
 Take a snapshot of all registry entries.
auto configure (thread_id id, thread_config const &config) -> result< void >
 Apply configuration to a registered thread.
auto set_priority (thread_id id, priority_level level) -> result< void >
 Set portable priority preset for a registered thread.
auto set_nice (thread_id id, nice_value value) -> result< void >
 Set explicit nice value for a registered thread.
auto get_priority (thread_id id) const -> result< priority_level >
 Query portable priority preset for a registered thread.
auto get_nice (thread_id id) const -> result< nice_value >
 Query nice value for a registered thread.

Static Public Member Functions

static auto create () -> result< thread_registry >
 Create an owning registry without throwing.

Friends

class global_registry_binding
class auto_register_current_thread
class advanced::composite_thread_registry
auto global_registry () ->thread_registry &

Detailed Description

Registry for named/configurable threads.

The global facade returned by global_registry is backed by runtime storage and can optionally be rebound to another registry via global_registry_binding.

Definition at line 60 of file thread_registry.hpp.

Constructor & Destructor Documentation

◆ thread_registry() [1/3]

threadschedule::thread_registry::thread_registry ( )
inline

Construct an owning registry instance.

Definition at line 64 of file thread_registry.hpp.

Referenced by create(), global_registry, operator=(), operator=(), thread_registry(), and thread_registry().

◆ thread_registry() [2/3]

threadschedule::thread_registry::thread_registry ( thread_registry && )
defaultnoexcept

References thread_registry().

◆ thread_registry() [3/3]

threadschedule::thread_registry::thread_registry ( thread_registry const & )
delete

References thread_registry().

Member Function Documentation

◆ configure()

auto threadschedule::thread_registry::configure ( thread_id id,
thread_config const & config )->result< void >
inline

Apply configuration to a registered thread.

Parameters
idRegistry thread id.
configPortable configuration to apply.

Definition at line 206 of file thread_registry.hpp.

References threadschedule::detail::to_native(), threadschedule::detail::try_result(), and threadschedule::unexpected().

◆ count()

auto threadschedule::thread_registry::count ( ) const->std::size_t
inlinenodiscard

Return number of tracked entries.

Definition at line 164 of file thread_registry.hpp.

◆ create()

auto threadschedule::thread_registry::create ( ) ->result< thread_registry >
inlinestatic

Create an owning registry without throwing.

Definition at line 124 of file thread_registry.hpp.

References thread_registry(), and threadschedule::detail::try_result().

◆ empty()

auto threadschedule::thread_registry::empty ( ) const->bool
inlinenodiscard

Return whether registry has no tracked entries.

Definition at line 171 of file thread_registry.hpp.

◆ get_nice()

auto threadschedule::thread_registry::get_nice ( thread_id id) const->result< nice_value >
inlinenodiscard

◆ get_priority()

auto threadschedule::thread_registry::get_priority ( thread_id id) const->result< priority_level >
inlinenodiscard

Query portable priority preset for a registered thread.

Definition at line 240 of file thread_registry.hpp.

References threadschedule::detail::to_priority_level(), threadschedule::detail::try_result(), and threadschedule::unexpected().

◆ operator=() [1/2]

◆ operator=() [2/2]

auto threadschedule::thread_registry::operator= ( thread_registry const & ) ->thread_registry &=delete
delete

References thread_registry().

◆ register_current_thread()

auto threadschedule::thread_registry::register_current_thread ( std::string name = {},
std::string component = {} )->result< void >
inline

Register the calling thread.

Parameters
nameOptional thread name.
componentOptional component label.

Definition at line 135 of file thread_registry.hpp.

◆ set_nice()

auto threadschedule::thread_registry::set_nice ( thread_id id,
nice_value value )->result< void >
inline

Set explicit nice value for a registered thread.

Definition at line 226 of file thread_registry.hpp.

References threadschedule::detail::native_schedule::posix_nice(), threadschedule::detail::try_result(), and threadschedule::unexpected().

Referenced by set_priority().

◆ set_priority()

auto threadschedule::thread_registry::set_priority ( thread_id id,
priority_level level )->result< void >
inline

Set portable priority preset for a registered thread.

Definition at line 219 of file thread_registry.hpp.

References set_nice().

◆ snapshot()

auto threadschedule::thread_registry::snapshot ( ) const->result< std::vector< registered_thread > >
inlinenodiscard

Take a snapshot of all registry entries.

Returns
Vector of registered_thread records.

Definition at line 181 of file thread_registry.hpp.

References threadschedule::detail::thread_id_access::make(), and threadschedule::detail::try_result().

◆ unregister_current_thread()

auto threadschedule::thread_registry::unregister_current_thread ( ) ->result< void >
inline

Unregister the calling thread.

Definition at line 150 of file thread_registry.hpp.

References threadschedule::detail::try_result(), and threadschedule::unexpected().

◆ advanced::composite_thread_registry

Definition at line 337 of file thread_registry.hpp.

◆ auto_register_current_thread

friend class auto_register_current_thread
friend

Definition at line 336 of file thread_registry.hpp.

References auto_register_current_thread.

Referenced by auto_register_current_thread.

◆ global_registry

auto global_registry ( ) ->thread_registry &
friend

Definition at line 341 of file thread_registry.hpp.

References thread_registry().

◆ global_registry_binding

friend class global_registry_binding
friend

Definition at line 335 of file thread_registry.hpp.

References global_registry_binding.

Referenced by global_registry_binding.


The documentation for this class was generated from the following file: