diff options
Diffstat (limited to 'Runtime/Threads/Winapi/PlatformMutex.h')
-rw-r--r-- | Runtime/Threads/Winapi/PlatformMutex.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Runtime/Threads/Winapi/PlatformMutex.h b/Runtime/Threads/Winapi/PlatformMutex.h new file mode 100644 index 0000000..11f174e --- /dev/null +++ b/Runtime/Threads/Winapi/PlatformMutex.h @@ -0,0 +1,28 @@ +#ifndef __PLATFORMMUTEX_H +#define __PLATFORMMUTEX_H + +#if SUPPORT_THREADS + +#include "Runtime/Utilities/NonCopyable.h" + +/** + * A platform/api specific mutex class. Always recursive (a single thread can lock multiple times). + */ +class PlatformMutex : public NonCopyable +{ + friend class Mutex; +protected: + PlatformMutex(); + ~PlatformMutex(); + + void Lock(); + void Unlock(); + bool TryLock(); + +private: + + CRITICAL_SECTION crit_sec; +}; + +#endif // SUPPORT_THREADS +#endif // __PLATFORMMUTEX_H |