22 lines
404 B
C++
22 lines
404 B
C++
#pragma once
|
|
|
|
#ifndef __x86_64__
|
|
#include "interrupts.h"
|
|
|
|
struct InterruptLock {
|
|
bool was_on;
|
|
|
|
InterruptLock() : was_on(EnableInterrupts(false)) {}
|
|
|
|
~InterruptLock() { EnableInterrupts(was_on); }
|
|
};
|
|
#else // __x86_64__
|
|
#include <mutex>
|
|
|
|
struct InterruptLock {
|
|
static std::recursive_mutex m;
|
|
InterruptLock() { m.lock(); }
|
|
~InterruptLock() { m.unlock(); }
|
|
};
|
|
#endif // __x86_64__
|