12#include <cheri-builtins.h>
32 0xffff'ffff'ffff'ffff;
116typedef union __if_c(__attribute__((transparent_union))) __TimeoutArgument
130 : absoluteTimeout(absoluteTimeout)
134 __TimeoutArgument(
Timeout *relativeTimeout)
135 : relativeTimeout(relativeTimeout)
144 return cheri_is_valid(relativeTimeout);
162 void elapse(
Ticks ticks);
176 void elapse_from(
Timeout &source)
183_Static_assert(
sizeof(TimeoutArgument) ==
sizeof(
void *),
184 "Timeout arguments should be passable in a single register");
200__if_c(
static) inline
bool timeout_is_relative(TimeoutArgument timeout)
202 return cheri_is_valid(timeout.relativeTimeout);
221__if_c(
static) inline
bool timeout_may_block(TimeoutArgument timeout)
244__if_c(
static) inline
void timeout_elapse_from(TimeoutArgument destination,
251inline bool TimeoutArgument::is_valid()
255inline bool TimeoutArgument::may_block()
257 return timeout_may_block(*
this);
259inline void TimeoutArgument::elapse(
Ticks ticks)
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.
bool __cheri_libcall check_timeout_pointer(const struct Timeout *timeout)
Check that the argument is a valid pointer to a Timeout structure.
uint32_t Ticks
Quantity used for measuring time for timeouts.
uint64_t AbsoluteMonotonicTimeout
Type used for absolute timeouts.
struct Timeout Timeout
Structure representing a timeout.
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.
union __if_c() __TimeoutArgument
A union to hold timeouts that are passed down to end up in the scheduler.
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...
static const AbsoluteMonotonicTimeout TimeoutNoWait
Timeout value for not blocking.
static const AbsoluteMonotonicTimeout TimeoutWaitForever
Timeout value for unlimited blocking.