mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-05-24 06:50:43 -04:00
Implement JASCriticalSection with a regular mutex
This commit is contained in:
@@ -8,12 +8,18 @@
|
||||
*
|
||||
*/
|
||||
class JASCriticalSection {
|
||||
public:
|
||||
#if TARGET_PC
|
||||
JASCriticalSection();
|
||||
~JASCriticalSection();
|
||||
#else
|
||||
public:
|
||||
JASCriticalSection() { mInterruptState = OSDisableInterrupts(); };
|
||||
~JASCriticalSection() { OSRestoreInterrupts(mInterruptState); };
|
||||
|
||||
private:
|
||||
u32 mInterruptState;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* JASCRITICALSECTION_H */
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#include "JSystem/JAudio2/JASCriticalSection.h"
|
||||
|
||||
#include <mutex>
|
||||
|
||||
static std::recursive_mutex gAudioThreadMutex;
|
||||
|
||||
JASCriticalSection::JASCriticalSection() {
|
||||
gAudioThreadMutex.lock();
|
||||
}
|
||||
|
||||
JASCriticalSection::~JASCriticalSection() {
|
||||
gAudioThreadMutex.unlock();
|
||||
}
|
||||
Reference in New Issue
Block a user