|
CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
|
This file contains the types used for timeouts across scheduler APIs. More...
Go to the source code of this file.
Classes | |
| struct | Timeout |
| Structure representing a timeout. More... | |
Typedefs | |
| typedef uint32_t | Ticks |
| Quantity used for measuring time for timeouts. | |
| typedef uint64_t | AbsoluteMonotonicTimeout |
| Type used for absolute timeouts. | |
| typedef struct Timeout | Timeout |
| Structure representing a timeout. | |
Functions | |
| union | __if_c () __TimeoutArgument |
| A union to hold timeouts that are passed down to end up in the scheduler. | |
| bool __cheri_libcall | check_timeout_pointer (const struct Timeout *timeout) |
| Check that the argument is a valid pointer to a Timeout structure. | |
| __if_c (static) inline bool timeout_is_relative(TimeoutArgument timeout) | |
| Helper to determine whether a timeout's relativeTimeout alternative is the active one. | |
| bool __cheriot_libcall | timeout_is_valid (TimeoutArgument timeout) |
| Returns true if this is a valid TimeoutArgument: either an untagged value or a valid pointer to a Timeout. | |
| bool __cheriot_libcall | timeout_has_expired (TimeoutArgument timeout) |
| Returns true if the timeout is in the past (for relative timeouts, if there is no remaining time), false otherwise. | |
| void __cheriot_libcall | timeout_elapse (TimeoutArgument timeout, Ticks ticks) |
| If this is a relative timeout, elapse the specified number of ticks. | |
Variables | |
| static const Ticks | UnlimitedTimeout = UINT32_MAX |
| Value indicating an unbounded timeout for use with Timeout. | |
| static const AbsoluteMonotonicTimeout | TimeoutWaitForever |
| Timeout value for unlimited blocking. | |
| static const AbsoluteMonotonicTimeout | TimeoutNoWait = 0 |
| Timeout value for not blocking. | |
| TimeoutArgument | |
| Timeout * | source |
This file contains the types used for timeouts across scheduler APIs.
Definition in file timeout.h.
| typedef uint64_t AbsoluteMonotonicTimeout |
| typedef uint32_t Ticks |
| typedef struct Timeout Timeout |
Structure representing a timeout.
This is intended to allow a single instance to be chained across blocking calls.
Timeouts may not be stored in the heap. Handling timeout structures that may disappear between sleeping and waking is very complicated and would impact a lot of fast paths. Instead, most functions that take a timeout will simply fail if the timeout is on the heap.
| union __if_c | ( | ) |
A union to hold timeouts that are passed down to end up in the scheduler.
These are one of two things:
This is a tagged union, with the CHERI tag bit used to differentiate between the two cases.
An absolute timeout.
A relative timeout.
Permit implicit construction from absolute timeouts.
Permit implicit construction from relative timeouts.
Returns true if this is a relative timeout, false otherwise.
Returns true if this is a valid timeout, false otherwise.
Returns true if the timeout is in the future (and therefore may still block), false otherwise.
If this is a relative timeout, elapse the specified number of ticks. Otherwise, do nothing.
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 35 of file timeout.h.
References TimeoutNoWait.
Referenced by run_once().
| __if_c | ( | static | ) |
Helper to determine whether a timeout's relativeTimeout alternative is the active one.
Take any ticks that have been counted towards source and apply it to destination.
Returns true if the timeout is in the future (and therefore may still block), false otherwise.
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.
| bool __cheri_libcall check_timeout_pointer | ( | const struct Timeout * | timeout | ) |
Check that the argument is a valid pointer to a Timeout structure.
This must have read/write permissions, be unsealed, and must not be a heap address.
This function is not recommended for new code. The more general timeout_is_valid call checks that this is a valid timeout argument.
| void __cheriot_libcall timeout_elapse | ( | TimeoutArgument | timeout, |
| Ticks | ticks ) |
If this is a relative timeout, elapse the specified number of ticks.
Otherwise, do nothing.
| Timeout* source |
|
static |
|
static |
Timeout value for unlimited blocking.
Definition at line 31 of file timeout.h.
Referenced by futex_wait(), and heap_quarantine_empty().
|
static |
Value indicating an unbounded timeout for use with Timeout.
Definition at line 22 of file timeout.h.
Referenced by thread_pool::async(), barrier_wait(), Timeout::elapse(), flaglock_lock(), flaglock_priority_inheriting_lock(), FlagLockGeneric< false >::lock(), RecursiveMutex::lock(), taskENTER_CRITICAL(), vStreamBufferDelete(), vTaskSuspendAll(), xEventGroupCreate(), xEventGroupSetBits(), xQueueCreate(), and xStreamBufferCreate().