FutexSpinWait: Implement spin-loop Unique mutex.

This commit is contained in:
Ryan Houdek 2023-12-28 17:35:57 -08:00
parent 136fa78825
commit 2c5dd20f3c

View File

@ -263,4 +263,18 @@ namespace FEXCore::Utils::FutexSpinWait {
#undef SPINLOOP_16BIT
#undef SPINLOOP_32BIT
#undef SPINLOOP_64BIT
template<typename T>
class UniqueSpinMutex final {
public:
UniqueSpinMutex(T *Futex)
: Futex {Futex} {
FEXCore::Utils::FutexSpinWait::lock(Futex);
}
~UniqueSpinMutex() {
FEXCore::Utils::FutexSpinWait::unlock(Futex);
}
private:
T *Futex;
};
}