CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Loading...
Searching...
No Matches
__TimeoutArgument Union Reference

A union to hold timeouts that are passed down to end up in the scheduler. More...

#include <timeout.h>

Collaboration diagram for __TimeoutArgument:

Public Member Functions

 __TimeoutArgument (AbsoluteMonotonicTimeout absoluteTimeout)
 Permit implicit construction from absolute timeouts.
 __TimeoutArgument (Timeout *relativeTimeout)
 Permit implicit construction from relative timeouts.
bool is_relative ()
 Returns true if this is a relative timeout, false otherwise.
bool is_valid ()
 Returns true if this is a valid timeout, false otherwise.
bool may_block ()
 Returns true if the timeout is in the future (and therefore may still block), false otherwise.
void elapse (Ticks ticks)
 If this is a relative timeout, elapse the specified number of ticks.
void elapse_from (Timeout &source)
 Take any ticks that have been counted towards source and apply it to destination.

Public Attributes

AbsoluteMonotonicTimeout absoluteTimeout
 An absolute timeout.
Timeout * relativeTimeout
 A relative timeout.

Detailed Description

A union to hold timeouts that are passed down to end up in the scheduler.

These are one of two things:

  • An absolute timeout, measured in cycles of some platform-specific timer (such as the mtime register) that increments at predictable rate.
  • A relative timeout counted in elapsed scheduler ticks.

This is a tagged union, with the CHERI tag bit used to differentiate between the two cases.

Definition at line 116 of file timeout.h.

Constructor & Destructor Documentation

◆ __TimeoutArgument() [1/2]

__TimeoutArgument::__TimeoutArgument ( AbsoluteMonotonicTimeout absoluteTimeout)
inline

Permit implicit construction from absolute timeouts.

Definition at line 129 of file timeout.h.

References absoluteTimeout.

◆ __TimeoutArgument() [2/2]

__TimeoutArgument::__TimeoutArgument ( Timeout * relativeTimeout)
inline

Permit implicit construction from relative timeouts.

Definition at line 134 of file timeout.h.

References relativeTimeout.

Member Function Documentation

◆ elapse()

void TimeoutArgument::elapse ( Ticks ticks)
inline

If this is a relative timeout, elapse the specified number of ticks.

Otherwise, do nothing.

Definition at line 259 of file timeout.h.

References timeout_elapse().

Referenced by elapse_from().

◆ elapse_from()

void __TimeoutArgument::elapse_from ( Timeout & source)
inline

Take any ticks that have been counted towards source and apply it to destination.

If destination is not a tick-counting relative timeout, do nothing.

This is intended for short-yielding operations, where a compartment wishes to yield for a small amount of time (typically one tick) and then retry some operation, rather than waiting for the whole time that the caller has allowed them to wait. The caller-provided timeout may be relative or absolute, but the timeout for the short sleep is local to the compartment doing the short sleep and so is always a Timeout.

Definition at line 176 of file timeout.h.

References elapse(), and Timeout::elapsed.

Referenced by LockGuard< Lock >::yield().

◆ is_relative()

bool __TimeoutArgument::is_relative ( )
inline

Returns true if this is a relative timeout, false otherwise.

Definition at line 142 of file timeout.h.

References relativeTimeout.

◆ is_valid()

bool TimeoutArgument::is_valid ( )
inline

Returns true if this is a valid timeout, false otherwise.

Definition at line 251 of file timeout.h.

References timeout_is_valid().

◆ may_block()

bool TimeoutArgument::may_block ( )
inline

Returns true if the timeout is in the future (and therefore may still block), false otherwise.

Definition at line 255 of file timeout.h.

References timeout_may_block().

Member Data Documentation

◆ absoluteTimeout

AbsoluteMonotonicTimeout __TimeoutArgument::absoluteTimeout

An absolute timeout.

Definition at line 121 of file timeout.h.

Referenced by __TimeoutArgument().

◆ relativeTimeout

Timeout* __TimeoutArgument::relativeTimeout

A relative timeout.

Definition at line 125 of file timeout.h.

Referenced by __TimeoutArgument(), and is_relative().


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