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

Validated CPU identifier. More...

#include <cpu_id.hpp>

Public Member Functions

constexpr cpu_id (int value)
 Construct a CPU id and throw on invalid input.
 
constexpr auto value () const noexcept -> std::uint32_t
 Return the underlying CPU index.
 

Static Public Member Functions

static auto create (int value) noexcept -> result< cpu_id >
 Construct a CPU id without exceptions.
 

Friends

constexpr auto operator== (cpu_id lhs, cpu_id rhs) noexcept -> bool
 
constexpr auto operator!= (cpu_id lhs, cpu_id rhs) noexcept -> bool
 
constexpr auto operator< (cpu_id lhs, cpu_id rhs) noexcept -> bool
 

Detailed Description

Validated CPU identifier.

This type guarantees a non-negative CPU index and is used by thread_affinity to avoid accidental mixing with unrelated integers.

Definition at line 22 of file cpu_id.hpp.

Constructor & Destructor Documentation

◆ cpu_id()

constexpr threadschedule::cpu_id::cpu_id ( int  value)
inlineexplicitconstexpr

Construct a CPU id and throw on invalid input.

Parameters
valueCPU index, must be >= 0.
Exceptions
std::invalid_argumentif value is negative.

Definition at line 30 of file cpu_id.hpp.

Member Function Documentation

◆ create()

static auto threadschedule::cpu_id::create ( int  value) -> result<cpu_id>
inlinestaticnoexcept

Construct a CPU id without exceptions.

Parameters
valueCPU index, must be >= 0.
Returns
A valid cpu_id or errc::invalid_argument.

Definition at line 38 of file cpu_id.hpp.

References value().

◆ value()

constexpr auto threadschedule::cpu_id::value ( ) const -> std::uint32_t
inlineconstexprnoexcept

Return the underlying CPU index.

Definition at line 47 of file cpu_id.hpp.

Referenced by create().

Friends And Related Symbol Documentation

◆ operator!=

constexpr auto operator!= ( cpu_id  lhs,
cpu_id  rhs 
) -> bool
friend

Definition at line 58 of file cpu_id.hpp.

◆ operator<

constexpr auto operator< ( cpu_id  lhs,
cpu_id  rhs 
) -> bool
friend

Definition at line 62 of file cpu_id.hpp.

◆ operator==

constexpr auto operator== ( cpu_id  lhs,
cpu_id  rhs 
) -> bool
friend

Definition at line 53 of file cpu_id.hpp.


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