summaryrefslogtreecommitdiffstats
path: root/src/OSSupport/CriticalSection.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-12-07 15:01:36 +0100
committerMattes D <github@xoft.cz>2014-12-07 15:01:36 +0100
commitd00ebd7ee700fcd7f30ea27d238ba1f0d56dfe21 (patch)
treeb0dbd8a8396ad22cf77cb4b367295d25ad3055a7 /src/OSSupport/CriticalSection.h
parentReduced river height (diff)
parentMerge remote-tracking branch 'origin/master' into c++11 (diff)
downloadcuberite-d00ebd7ee700fcd7f30ea27d238ba1f0d56dfe21.tar
cuberite-d00ebd7ee700fcd7f30ea27d238ba1f0d56dfe21.tar.gz
cuberite-d00ebd7ee700fcd7f30ea27d238ba1f0d56dfe21.tar.bz2
cuberite-d00ebd7ee700fcd7f30ea27d238ba1f0d56dfe21.tar.lz
cuberite-d00ebd7ee700fcd7f30ea27d238ba1f0d56dfe21.tar.xz
cuberite-d00ebd7ee700fcd7f30ea27d238ba1f0d56dfe21.tar.zst
cuberite-d00ebd7ee700fcd7f30ea27d238ba1f0d56dfe21.zip
Diffstat (limited to 'src/OSSupport/CriticalSection.h')
-rw-r--r--src/OSSupport/CriticalSection.h14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/OSSupport/CriticalSection.h b/src/OSSupport/CriticalSection.h
index c3c6e57f0..17fcdfc12 100644
--- a/src/OSSupport/CriticalSection.h
+++ b/src/OSSupport/CriticalSection.h
@@ -1,5 +1,7 @@
#pragma once
+#include <mutex>
+#include <thread>
@@ -8,8 +10,6 @@
class cCriticalSection
{
public:
- cCriticalSection(void);
- ~cCriticalSection();
void Lock(void);
void Unlock(void);
@@ -17,6 +17,7 @@ public:
// IsLocked/IsLockedByCurrentThread are only used in ASSERT statements, but because of the changes with ASSERT they must always be defined
// The fake versions (in Release) will not effect the program in any way
#ifdef _DEBUG
+ cCriticalSection(void);
bool IsLocked(void);
bool IsLockedByCurrentThread(void);
#else
@@ -27,15 +28,10 @@ public:
private:
#ifdef _DEBUG
int m_IsLocked; // Number of times this CS is locked
- unsigned long m_OwningThreadID;
+ std::thread::id m_OwningThreadID;
#endif // _DEBUG
- #ifdef _WIN32
- CRITICAL_SECTION m_CriticalSection;
- #else // _WIN32
- pthread_mutex_t m_CriticalSection;
- pthread_mutexattr_t m_Attributes;
- #endif // else _WIN32
+ std::recursive_mutex m_Mutex;
} ALIGN_8;