12#include <cheri-builtins.h>
32 0xffff'ffff'ffff'ffff;
162 void elapse(
Ticks ticks);
184 "Timeout arguments should be passable in a single register");
202 return cheri_is_valid(timeout.relativeTimeout);
Structure representing a timeout.
bool may_block()
Helper indicating whether the owner of this timeout may block.
Ticks elapsed
The time that has elapsed during blocking operations for this timeout structure.
void elapse(Ticks time)
Update this timeout if time ticks have elapsed.
Timeout(Ticks elapsed, Ticks remaining)
Constructor that initialises both fields, should be used only for initialiser-list initialisation in ...
Ticks remaining
The remaining time.
Timeout(Ticks time)
Constructor, initialises this structure to allow time ticks to elapse.
__cheriot_libcall time_t time(time_t *tloc)
POSIX-compatible time() implementation.
bool __cheri_libcall check_timeout_pointer(const struct Timeout *timeout)
Check that the argument is a valid pointer to a Timeout structure.
bool timeout_is_relative(TimeoutArgument timeout)
Helper to determine whether a timeout's relativeTimeout alternative is the active one.
union __TimeoutArgument TimeoutArgument
A union to hold timeouts that are passed down to end up in the scheduler.
uint32_t Ticks
Quantity used for measuring time for timeouts.
uint64_t AbsoluteMonotonicTimeout
Type used for absolute timeouts.
void timeout_elapse_from(TimeoutArgument destination, Timeout *source)
Take any ticks that have been counted towards source and apply it to destination.
static const Ticks UnlimitedTimeout
Value indicating an unbounded timeout for use with 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),...
void __cheriot_libcall timeout_elapse(TimeoutArgument timeout, Ticks ticks)
If this is a relative timeout, elapse the specified number of ticks.
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 Tim...
bool timeout_may_block(TimeoutArgument timeout)
Returns true if the timeout is in the future (and therefore may still block), false otherwise.
static const AbsoluteMonotonicTimeout TimeoutNoWait
Timeout value for not blocking.
static const AbsoluteMonotonicTimeout TimeoutWaitForever
Timeout value for unlimited blocking.
Timeout * relativeTimeout
A relative timeout.
bool is_relative()
Returns true if this is a relative timeout, false otherwise.
__TimeoutArgument(Timeout *relativeTimeout)
Permit implicit construction from relative timeouts.
void elapse(Ticks ticks)
If this is a relative timeout, elapse the specified number of ticks.
AbsoluteMonotonicTimeout absoluteTimeout
An absolute timeout.
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.
__TimeoutArgument(AbsoluteMonotonicTimeout absoluteTimeout)
Permit implicit construction from absolute timeouts.
void elapse_from(Timeout &source)
Take any ticks that have been counted towards source and apply it to destination.