diff --git a/FEXCore/Source/Utils/FutexSpinWait.h b/FEXCore/Source/Utils/FutexSpinWait.h index 7bb53561d..c75252c8d 100644 --- a/FEXCore/Source/Utils/FutexSpinWait.h +++ b/FEXCore/Source/Utils/FutexSpinWait.h @@ -263,4 +263,18 @@ namespace FEXCore::Utils::FutexSpinWait { #undef SPINLOOP_16BIT #undef SPINLOOP_32BIT #undef SPINLOOP_64BIT + template + class UniqueSpinMutex final { + public: + UniqueSpinMutex(T *Futex) + : Futex {Futex} { + FEXCore::Utils::FutexSpinWait::lock(Futex); + } + + ~UniqueSpinMutex() { + FEXCore::Utils::FutexSpinWait::unlock(Futex); + } + private: + T *Futex; + }; }