#pragma once #include struct Spinlock { public: void acquire(); void release(); bool locked(); private: volatile uint64_t m_lock = 0; }; void lock(Spinlock& lock, void (*action)(void));