From 6d5a8892f34f4034b38da467268de9d489e1024e Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 19 Oct 2014 00:29:34 +0100 Subject: Use std::thread --- src/OSSupport/CriticalSection.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/OSSupport/CriticalSection.h') diff --git a/src/OSSupport/CriticalSection.h b/src/OSSupport/CriticalSection.h index c3c6e57f0..7822a5471 100644 --- a/src/OSSupport/CriticalSection.h +++ b/src/OSSupport/CriticalSection.h @@ -27,7 +27,7 @@ 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 -- cgit v1.2.3 From a324333c11c7cc981104ae0483a0203c34e0e991 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 20 Oct 2014 21:26:18 +0100 Subject: Use std::recusive_mutex --- src/OSSupport/CriticalSection.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/OSSupport/CriticalSection.h') diff --git a/src/OSSupport/CriticalSection.h b/src/OSSupport/CriticalSection.h index 7822a5471..19e4f78af 100644 --- a/src/OSSupport/CriticalSection.h +++ b/src/OSSupport/CriticalSection.h @@ -1,5 +1,6 @@ #pragma once +#include @@ -8,8 +9,6 @@ class cCriticalSection { public: - cCriticalSection(void); - ~cCriticalSection(); void Lock(void); void Unlock(void); @@ -17,6 +16,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 @@ -30,12 +30,7 @@ private: 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; -- cgit v1.2.3 From 51fa6b4090ee930d03592550613592b1087fb788 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Thu, 23 Oct 2014 23:58:01 +0100 Subject: Suggestions --- src/OSSupport/CriticalSection.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/OSSupport/CriticalSection.h') diff --git a/src/OSSupport/CriticalSection.h b/src/OSSupport/CriticalSection.h index 19e4f78af..17fcdfc12 100644 --- a/src/OSSupport/CriticalSection.h +++ b/src/OSSupport/CriticalSection.h @@ -1,6 +1,7 @@ #pragma once #include +#include -- cgit v1.2.3