contur2
Loading...
Searching...
No Matches

Composite priority descriptor for a process. More...

#include <priority.h>

Public Member Functions

constexpr Priority () noexcept=default
 Default-constructs a Normal-priority descriptor.
constexpr Priority (PriorityLevel level) noexcept
 Constructs a priority with the given base level. Effective is initialized to match base; nice defaults to 0.
constexpr Priority (PriorityLevel base, PriorityLevel effective, std::int32_t nice) noexcept
 Constructs a priority with base, effective, and nice values.
constexpr bool operator== (const Priority &other) const noexcept
 Compares two Priority descriptors for equality.
constexpr bool operator!= (const Priority &other) const noexcept
 Compares two Priority descriptors for inequality.
constexpr bool isHigherThan (const Priority &other) const noexcept
 Returns true if this priority is higher (numerically lower) than other, based on effective level. Tie-broken by nice value (lower nice = higher prio).

Static Public Member Functions

static constexpr std::int32_t clampNice (std::int32_t value) noexcept
 Clamps a nice value to the valid range [NICE_MIN, NICE_MAX].

Public Attributes

PriorityLevel base = PriorityLevel::Normal
 Static priority assigned at creation.
PriorityLevel effective = PriorityLevel::Normal
 Dynamic priority used by scheduler.
std::int32_t nice = NICE_DEFAULT
 Fine-grained adjustment (-20..+19).

Detailed Description

Composite priority descriptor for a process.

  • base — assigned at creation, does not change during normal execution.
  • effective — adjusted dynamically by the scheduler (e.g., starvation prevention, I/O boost, priority inheritance).
  • nice — Unix-style fine-grained adjustment (range: NICE_MIN..NICE_MAX).

Definition at line 45 of file priority.h.

Constructor & Destructor Documentation

◆ Priority() [1/3]

contur::Priority::Priority ( )
constexprdefaultnoexcept

Default-constructs a Normal-priority descriptor.

◆ Priority() [2/3]

contur::Priority::Priority ( PriorityLevel level)
inlineexplicitconstexprnoexcept

Constructs a priority with the given base level. Effective is initialized to match base; nice defaults to 0.

Definition at line 56 of file priority.h.

◆ Priority() [3/3]

contur::Priority::Priority ( PriorityLevel base,
PriorityLevel effective,
std::int32_t nice )
inlineconstexprnoexcept

Constructs a priority with base, effective, and nice values.

Definition at line 63 of file priority.h.

Member Function Documentation

◆ clampNice()

constexpr std::int32_t contur::Priority::clampNice ( std::int32_t value)
inlinestaticnodiscardconstexprnoexcept

Clamps a nice value to the valid range [NICE_MIN, NICE_MAX].

Definition at line 93 of file priority.h.

◆ isHigherThan()

bool contur::Priority::isHigherThan ( const Priority & other) const
inlinenodiscardconstexprnoexcept

Returns true if this priority is higher (numerically lower) than other, based on effective level. Tie-broken by nice value (lower nice = higher prio).

Definition at line 83 of file priority.h.

◆ operator!=()

bool contur::Priority::operator!= ( const Priority & other) const
inlinenodiscardconstexprnoexcept

Compares two Priority descriptors for inequality.

Definition at line 76 of file priority.h.

◆ operator==()

bool contur::Priority::operator== ( const Priority & other) const
inlinenodiscardconstexprnoexcept

Compares two Priority descriptors for equality.

Definition at line 70 of file priority.h.

Member Data Documentation

◆ base

PriorityLevel contur::Priority::base = PriorityLevel::Normal

Static priority assigned at creation.

Definition at line 47 of file priority.h.

◆ effective

PriorityLevel contur::Priority::effective = PriorityLevel::Normal

Dynamic priority used by scheduler.

Definition at line 48 of file priority.h.

◆ nice

std::int32_t contur::Priority::nice = NICE_DEFAULT

Fine-grained adjustment (-20..+19).

Definition at line 49 of file priority.h.


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