mbv: move a few things around
This commit is contained in:
21
mbv/lib/lock.h
Normal file
21
mbv/lib/lock.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __x86_64__
|
||||
#include "hal/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__
|
Reference in New Issue
Block a user