MHAA Interrupt Control Core v1.0.0
Interrupt gate control and scoped restoration
Loading...
Searching...
No Matches
scoped_disable.hpp
Go to the documentation of this file.
1#ifndef MHAA_INTERRUPT_SCOPED_DISABLE_HPP
2#define MHAA_INTERRUPT_SCOPED_DISABLE_HPP
3
4#include <interrupt/mask_control.hpp>
5
6namespace mhaa
7{
8 namespace interrupt
9 {
12 {
13 public:
14 explicit ScopedDisable(MaskControl &control) noexcept
15 : control_(control), was_enabled_(control.save_and_disable()) {}
16
17 ~ScopedDisable() { control_.restore(was_enabled_); }
18
19 ScopedDisable(const ScopedDisable &) = delete;
21
22 private:
23 MaskControl &control_;
24 const bool was_enabled_;
25 };
26 }
27}
28
29#endif
ScopedDisable(const ScopedDisable &)=delete
ScopedDisable & operator=(const ScopedDisable &)=delete
ScopedDisable(MaskControl &control) noexcept