summaryrefslogtreecommitdiff
path: root/Runtime/Threads/Winapi/PlatformMutex.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-08-14 22:50:43 +0800
committerchai <chaifix@163.com>2019-08-14 22:50:43 +0800
commit15740faf9fe9fe4be08965098bbf2947e096aeeb (patch)
treea730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/Threads/Winapi/PlatformMutex.h
+Unity Runtime codeHEADmaster
Diffstat (limited to 'Runtime/Threads/Winapi/PlatformMutex.h')
-rw-r--r--Runtime/Threads/Winapi/PlatformMutex.h28
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