#ifndef PSCToolbox_SpinLock_H #define PSCToolbox_SpinLock_H #include #include namespace Psc { struct Empty_Lock { void lock(); void unlock(); bool tryLock(); bool tryLock(int durationMillis); }; struct Spin_Lock { void lock(); bool tryLock(); bool tryLock(int durationMillis); void unlock(); protected: std::atomic_flag flag = ATOMIC_FLAG_INIT; }; } #endif