distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
distortos::internal::RoundRobinQuantum Class Reference

RoundRobinQuantum class is a quantum of time for round-robin scheduling. More...

#include "distortos/internal/scheduler/RoundRobinQuantum.hpp"

Public Types

using Representation = uint8_t
 type of quantum counter More...
 
using Duration = std::chrono::duration< Representation, TickClock::period >
 duration type used for quantum More...
 

Public Member Functions

constexpr RoundRobinQuantum ()
 RoundRobinQuantum's constructor. More...
 
void decrement ()
 Decrements round-robin's quantum. More...
 
Duration get () const
 Gets current value of round-robin's quantum. More...
 
bool isZero () const
 Convenience function to test whether the quantum is already at 0. More...
 
void reset ()
 Resets value of round-robin's quantum. More...
 

Static Public Member Functions

static constexpr Duration getInitial ()
 

Private Attributes

Duration quantum_
 round-robin quantum More...
 

Static Private Attributes

static constexpr auto quantumRawInitializer_
 raw initializer value for round-robin quantum, calculated with rounding to nearest More...
 

Detailed Description

RoundRobinQuantum class is a quantum of time for round-robin scheduling.

Member Typedef Documentation

◆ Duration

duration type used for quantum

◆ Representation

type of quantum counter

Constructor & Destructor Documentation

◆ RoundRobinQuantum()

constexpr distortos::internal::RoundRobinQuantum::RoundRobinQuantum ( )
inline

RoundRobinQuantum's constructor.

Initializes quantum value to initial value - just like after call to reset().

Here is the call graph for this function:

Member Function Documentation

◆ decrement()

void distortos::internal::RoundRobinQuantum::decrement ( )
inline

Decrements round-robin's quantum.

This function should be called from tick interrupt for the currently running thread. Underflow of quantum after this decrement is not possible.

Note
this function must be called with enabled interrupt masking
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get()

Duration distortos::internal::RoundRobinQuantum::get ( ) const
inline

Gets current value of round-robin's quantum.

Returns
current value of round-robin's quantum of the thread

◆ getInitial()

static constexpr Duration distortos::internal::RoundRobinQuantum::getInitial ( )
inlinestatic
Returns
initial value for round-robin quantum
Here is the caller graph for this function:

◆ isZero()

bool distortos::internal::RoundRobinQuantum::isZero ( ) const
inline

Convenience function to test whether the quantum is already at 0.

Returns
true if quantum is zero, false otherwise
Here is the caller graph for this function:

◆ reset()

void distortos::internal::RoundRobinQuantum::reset ( )
inline

Resets value of round-robin's quantum.

This function should be called from context switcher after selecting new task that will be run.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ quantum_

Duration distortos::internal::RoundRobinQuantum::quantum_
private

round-robin quantum

◆ quantumRawInitializer_

constexpr auto distortos::internal::RoundRobinQuantum::quantumRawInitializer_
staticprivate
Initial value:
= (DISTORTOS_TICK_FREQUENCY + DISTORTOS_ROUND_ROBIN_FREQUENCY / 2) /
DISTORTOS_ROUND_ROBIN_FREQUENCY

raw initializer value for round-robin quantum, calculated with rounding to nearest


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