CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Loading...
Searching...
No Matches
timeout.hh
1// Copyright Microsoft and CHERIoT Contributors.
2// SPDX-License-Identifier: MIT
3
4#pragma once
5#include <functional>
6#include <timeout.h>
7
8/**
9 * Helper to turn a function that takes a timeout into one that may block
10 * forever.
11 */
12template<auto Fn, typename... Args>
13__always_inline auto blocking_forever(Args... args)
14{
15 return Fn(TimeoutWaitForever, std::forward<Args>(args)...);
16}
17
18/**
19 * Helper to turn a function that takes a timeout into one that may not yield
20 */
21template<auto Fn, typename... Args>
22__always_inline auto non_blocking(Args... args)
23{
24 return Fn(TimeoutNoWait, std::forward<Args>(args)...);
25}
This file contains the types used for timeouts across scheduler APIs.
static const AbsoluteMonotonicTimeout TimeoutNoWait
Timeout value for not blocking.
Definition timeout.h:35
static const AbsoluteMonotonicTimeout TimeoutWaitForever
Timeout value for unlimited blocking.
Definition timeout.h:31