Lazy, functional-style query/filter view over a snapshot of registered threads.
More...
Lazy, functional-style query/filter view over a snapshot of registered threads.
A QueryView is produced by ThreadRegistry::query() (or by chaining operations on an existing QueryView). It holds an internal std::vector<RegisteredThreadInfo> that is a snapshot – mutations to the originating ThreadRegistry after the QueryView was created are not visible.
- Value semantics
- QueryView is a regular value type (copyable and movable). All transformation methods (filter, take, skip) return a new QueryView, leaving the original unchanged.
- Thread safety
- A single QueryView instance is not safe to use concurrently from multiple threads. However, it is safe to create multiple QueryViews concurrently from the same ThreadRegistry, since creation acquires a shared lock on the registry.
- API
- Provides a functional-style interface:
- filter(pred) – returns a new QueryView containing only entries that satisfy
pred.
- map(fn) – transforms each entry and returns a
std::vector<R>.
- for_each(fn) – applies
fn to every entry.
- find_if(pred) – returns the first matching entry, or
std::nullopt.
- any / all / none(pred) – boolean aggregation predicates.
- take(n) / skip(n) – positional slicing, returning new QueryViews.
- count() / empty() – size queries.
- entries() – direct access to the underlying vector.
Definition at line 471 of file thread_registry.hpp.