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

Aggregates multiple ThreadRegistry instances into a single queryable view. More...

#include <thread_registry.hpp>

Inheritance diagram for threadschedule::CompositeThreadRegistry:
[legend]
Collaboration diagram for threadschedule::CompositeThreadRegistry:
[legend]

Public Member Functions

void attach (ThreadRegistry *reg)
auto query () const -> ThreadRegistry::QueryView
Public Member Functions inherited from threadschedule::detail::QueryFacadeMixin< CompositeThreadRegistry >
auto filter (Predicate &&pred) const
auto count () const -> size_t
auto empty () const -> bool
void for_each (Fn &&fn) const
void apply (Predicate &&pred, Fn &&fn) const
auto map (Fn &&fn) const -> std::vector< std::invoke_result_t< Fn, RegisteredThreadInfo const & > >
auto find_if (Predicate &&pred) const -> std::optional< RegisteredThreadInfo >
auto any (Predicate &&pred) const -> bool
auto all (Predicate &&pred) const -> bool
auto none (Predicate &&pred) const -> bool
auto take (size_t n) const
auto skip (size_t n) const

Detailed Description

Aggregates multiple ThreadRegistry instances into a single queryable view.

CompositeThreadRegistry is useful when threads are spread across several independent ThreadRegistry instances (e.g. one per shared library) and you want a unified query interface over all of them.

Thread safety
All public methods are thread-safe. The internal list of attached registries is protected by a std::mutex.
Copyability / movability
Not copyable and not movable (holds a std::mutex).
Ownership
attach() stores raw pointers to the supplied registries. The caller is responsible for ensuring that every attached ThreadRegistry outlives this CompositeThreadRegistry. Violating this results in undefined behaviour.
Deduplication
No deduplication is performed. If the same TID appears in multiple attached registries, it will appear multiple times in the merged QueryView.
Querying
query() iterates over every attached registry, calls its own query(), and concatenates the results into a single ThreadRegistry::QueryView snapshot. The same functional-style helpers (filter, map, for_each, etc.) are inherited from detail::QueryFacadeMixin.

Definition at line 802 of file thread_registry.hpp.

Member Function Documentation

◆ attach()

void threadschedule::CompositeThreadRegistry::attach ( ThreadRegistry * reg)
inline

Definition at line 805 of file thread_registry.hpp.

◆ query()

auto threadschedule::CompositeThreadRegistry::query ( ) const -> ThreadRegistry::QueryView
inlinenodiscard

Definition at line 813 of file thread_registry.hpp.


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