2023-06-12 14:46:44 -04:00
|
|
|
#ifndef MXCRITICALSECTION_H
|
|
|
|
#define MXCRITICALSECTION_H
|
|
|
|
|
2024-05-30 16:38:42 -04:00
|
|
|
#include <SDL3/SDL_mutex.h>
|
2023-06-12 14:46:44 -04:00
|
|
|
|
2023-11-28 08:26:39 -05:00
|
|
|
// SIZE 0x1c
|
2023-10-24 19:38:27 -04:00
|
|
|
class MxCriticalSection {
|
2023-06-12 14:46:44 -04:00
|
|
|
public:
|
2024-01-24 21:16:29 -05:00
|
|
|
MxCriticalSection();
|
|
|
|
~MxCriticalSection();
|
2024-05-30 15:03:43 -04:00
|
|
|
|
2024-01-24 21:16:29 -05:00
|
|
|
static void SetDoMutex();
|
2024-05-30 15:03:43 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
void Enter();
|
|
|
|
void Leave();
|
2023-06-12 14:46:44 -04:00
|
|
|
|
|
|
|
private:
|
2024-05-30 16:38:42 -04:00
|
|
|
// [library:synchronization]
|
|
|
|
// SDL uses the most efficient mutex implementation available on the target platform.
|
|
|
|
// Originally this class allowed working with either a Win32 CriticalSection or Mutex,
|
|
|
|
// but only CriticalSection was ever used and we don't need both anyway.
|
|
|
|
SDL_Mutex* m_mutex;
|
2023-06-12 14:46:44 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MXCRITICALSECTION_H
|