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

Strongly-typed nice value in the POSIX range $[-20, 19]$. More...

#include <nice_value.hpp>

Public Member Functions

constexpr nice_value (int value)
 Construct and validate a nice value.
constexpr auto value () const noexcept -> int
 Return the wrapped nice value.

Static Public Member Functions

static auto create (int value) noexcept -> result< nice_value >
 Construct a nice value without exceptions.

Static Public Attributes

static constexpr int minimum = -20
 Lowest accepted nice value (highest priority).
static constexpr int maximum = 19
 Highest accepted nice value (lowest priority).

Friends

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

Detailed Description

Strongly-typed nice value in the POSIX range $[-20, 19]$.

Definition at line 18 of file nice_value.hpp.

Constructor & Destructor Documentation

◆ nice_value()

threadschedule::nice_value::nice_value ( int value)
inlineexplicitconstexpr

Construct and validate a nice value.

Parameters
valueNice value in the range minimum .. maximum.
Exceptions
std::invalid_argumentif value is out of range.

Definition at line 31 of file nice_value.hpp.

References value().

Referenced by create(), operator!=, and operator==.

Member Function Documentation

◆ create()

auto threadschedule::nice_value::create ( int value) ->result< nice_value >
inlinestaticnodiscardnoexcept

Construct a nice value without exceptions.

Parameters
valueNice value in the range minimum .. maximum.
Returns
A valid nice_value or errc::invalid_argument.

Definition at line 39 of file nice_value.hpp.

References maximum, nice_value(), threadschedule::unexpected(), and value().

Referenced by threadschedule::detail::portable_thread_control::get_nice().

◆ value()

auto threadschedule::nice_value::value ( ) const->int
inlinenodiscardconstexprnoexcept

Return the wrapped nice value.

Definition at line 48 of file nice_value.hpp.

Referenced by create(), and nice_value().

◆ operator!=

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

Definition at line 59 of file nice_value.hpp.

References nice_value().

◆ operator==

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

Definition at line 54 of file nice_value.hpp.

References nice_value().

Member Data Documentation

◆ maximum

int threadschedule::nice_value::maximum = 19
staticconstexpr

Highest accepted nice value (lowest priority).

Definition at line 24 of file nice_value.hpp.

Referenced by create().

◆ minimum

int threadschedule::nice_value::minimum = -20
staticconstexpr

Lowest accepted nice value (highest priority).

Definition at line 22 of file nice_value.hpp.


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