15 lines
219 B
C++
15 lines
219 B
C++
#pragma once
|
|
#include <stdint.h>
|
|
|
|
struct Spinlock
|
|
{
|
|
public:
|
|
void acquire();
|
|
void release();
|
|
bool locked();
|
|
|
|
private:
|
|
volatile uint64_t m_lock = 0;
|
|
};
|
|
|
|
void lock(Spinlock& lock, void (*action)(void)); |