Class TopologyProvider

Class Documentation

class TopologyProvider

Application-supplied discovery and calling-thread CPU-binding boundary.

Methods must support concurrent pool workers. Retain the provider through pool shutdown; binding must preserve memory placement.

See also

Worker topology

Public Functions

virtual ~TopologyProvider() = default

Release provider state after all pools using it have finished.

See also

Detailed guide

virtual Topology topology() const = 0

Declaration: [[nodiscard]]

Return an owned discovery snapshot.

See also

Detailed guide

Returns:

Copyable topology data independent of subsequent native queries. Implementations support concurrent worker calls; topology visibility alone does not establish binding or a speedup.

virtual std::vector<unsigned int> current_thread_cpus() const = 0

Declaration: [[nodiscard]]

Query the calling thread’s actual native CPU mask.

See also

Detailed guide

Returns:

Sorted distinct OS CPU IDs. Failure to establish a usable native mask must reject rather than invent eligibility.

virtual void bind_current_thread(const std::vector<unsigned int> &cpus) const = 0

Bind only the calling thread while preserving memory placement.

See also

Detailed guide

Parameters:

cpus – Requested eligible OS CPU IDs. The pool reads the native mask back before admitting the job. Unsupported/failed binding rejects; other threads and NUMA placement must not be silently changed.