Iros
 
Loading...
Searching...
No Matches
preemption.h
Go to the documentation of this file.
1#pragma once
2
4#include "di/util/prelude.h"
5
6namespace iris {
7class Task;
8
10public:
12
13 PreemptionDisabler(PreemptionDisabler&& other) : m_task(di::exchange(other.m_task, nullptr)) {}
14
16
17private:
18 Task* m_task { nullptr };
19};
20
21template<di::concepts::Invocable F>
22auto with_preemption_disabled(F&& function) -> decltype(auto) {
23 auto guard = PreemptionDisabler {};
24 return di::invoke(di::forward<F>(function));
25}
26}
Definition preemption.h:9
~PreemptionDisabler()
Definition preemption.cpp:21
PreemptionDisabler(PreemptionDisabler &&other)
Definition preemption.h:13
PreemptionDisabler()
Definition preemption.cpp:8
Definition task.h:30
Definition zstring_parser.h:9
constexpr auto exchange(T &object, U &&new_value) -> T
Definition exchange.h:8
constexpr auto invoke
Definition invoke.h:100
Definition cxx_init.cpp:12
auto with_preemption_disabled(F &&function) -> decltype(auto)
Definition preemption.h:22