From 15740faf9fe9fe4be08965098bbf2947e096aeeb Mon Sep 17 00:00:00 2001 From: chai <chaifix@163.com> Date: Wed, 14 Aug 2019 22:50:43 +0800 Subject: +Unity Runtime code --- Runtime/Threads/Winapi/PlatformMutex.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Runtime/Threads/Winapi/PlatformMutex.h (limited to 'Runtime/Threads/Winapi/PlatformMutex.h') 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 -- cgit v1.1-26-g67d0