A fixed-capacity, SMP-aware set of CPU identifiers.
More...
|
|
auto | any () const noexcept -> bool |
| | Returns true if the set is non-empty.
|
| auto | clear (usize cpu, memory_order order=memory_order::seq_cst) noexcept -> void |
| | Atomically remove a CPU from the set.
|
|
auto | clear_relaxed (usize cpu) noexcept -> void |
| | Non-atomically remove a CPU (use only when externally serialized).
|
|
auto | count () const noexcept -> usize |
| | Number of CPUs currently in the set.
|
| auto | first_set () const noexcept -> std::optional< usize > |
| | Index of the lowest-numbered member.
|
| template<typename Fn> |
| auto | for_each (Fn &&fn, memory_order confirm=memory_order::acquire) const noexcept -> void |
| | Invoke fn for every member CPU, in ascending id order.
|
| auto | next_set (usize after) const noexcept -> std::optional< usize > |
| | Index of the lowest-numbered member strictly after after.
|
|
auto | none () const noexcept -> bool |
| | Returns true if the set is empty.
|
|
auto | reset () noexcept -> void |
| | Remove every CPU from the set.
|
| auto | set (usize cpu, memory_order order=memory_order::seq_cst) noexcept -> void |
| | Atomically add a CPU to the set.
|
|
auto | set_relaxed (usize cpu) noexcept -> void |
| | Non-atomically add a CPU (use only when externally serialized).
|
| auto | test (usize cpu, memory_order order=memory_order::relaxed) const noexcept -> bool |
| | Atomically test whether a CPU is in the set.
|
|
|
static constexpr auto | capacity () noexcept -> usize |
| | Maximum number of CPUs this mask can represent.
|
A fixed-capacity, SMP-aware set of CPU identifiers.
- Note
- No heap allocation; the storage is static, like static_bitmap.
◆ clear()
| auto lib::cpumask::clear |
( |
usize | cpu, |
|
|
memory_order | order = memory_order::seq_cst )->void |
|
inlineexportnoexcept |
Atomically remove a CPU from the set.
- Parameters
-
| [in] | cpu | CPU identifier (0 to capacity()-1). |
| [in] | order | Memory ordering (default seq_cst). |
◆ first_set()
| auto lib::cpumask::first_set |
( |
| ) |
const->std::optional< usize > |
|
inlinenodiscardexportnoexcept |
Index of the lowest-numbered member.
- Returns
- The CPU id, or nullopt if the set is empty.
◆ for_each()
template<typename Fn>
| auto lib::cpumask::for_each |
( |
Fn && | fn, |
|
|
memory_order | confirm = memory_order::acquire ) const->void |
|
inlineexportnoexcept |
Invoke fn for every member CPU, in ascending id order.
- Template Parameters
-
| Fn | Callable invocable as fn(u16 cpu). |
- Parameters
-
| [in] | fn | Callback receiving each member CPU id. |
| [in] | confirm | Memory ordering used to re-confirm membership. |
◆ next_set()
| auto lib::cpumask::next_set |
( |
usize | after | ) |
const->std::optional< usize > |
|
inlinenodiscardexportnoexcept |
Index of the lowest-numbered member strictly after after.
- Parameters
-
| [in] | after | Index to search past (the result is always > after). |
- Returns
- The next member CPU id, or nullopt if none follows.
◆ set()
| auto lib::cpumask::set |
( |
usize | cpu, |
|
|
memory_order | order = memory_order::seq_cst )->void |
|
inlineexportnoexcept |
Atomically add a CPU to the set.
- Parameters
-
| [in] | cpu | CPU identifier (0 to capacity()-1). |
| [in] | order | Memory ordering (default seq_cst). |
◆ test()
| auto lib::cpumask::test |
( |
usize | cpu, |
|
|
memory_order | order = memory_order::relaxed ) const->bool |
|
inlinenodiscardexportnoexcept |
Atomically test whether a CPU is in the set.
- Parameters
-
| [in] | cpu | CPU identifier (0 to capacity()-1). |
| [in] | order | Memory ordering (default relaxed). |
- Returns
- true if the CPU is a member.
The documentation for this class was generated from the following file: