CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Toggle main menu visibility
Loading...
Searching...
No Matches
sdk
include
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
*/
12
template
<
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
*/
21
template
<
auto
Fn,
typename
... Args>
22
__always_inline
auto
non_blocking(Args... args)
23
{
24
return
Fn(
TimeoutNoWait
, std::forward<Args>(args)...);
25
}
timeout.h
This file contains the types used for timeouts across scheduler APIs.
TimeoutNoWait
static const AbsoluteMonotonicTimeout TimeoutNoWait
Timeout value for not blocking.
Definition
timeout.h:35
TimeoutWaitForever
static const AbsoluteMonotonicTimeout TimeoutWaitForever
Timeout value for unlimited blocking.
Definition
timeout.h:31
Generated by
1.18.0