Revert "Further attempts at fixing segfault in locks"

This reverts commit dd93ba7ec4.
This commit is contained in:
Deukhoofd 2022-02-11 13:42:28 +01:00
parent dd93ba7ec4
commit 9c84058e1b
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 4 additions and 8 deletions

View File

@ -198,7 +198,7 @@ public:
bool TryEnter();
protected:
std::mutex* _mutex;
std::unique_ptr<std::mutex> _mutex;
};
class asCThreadReadWriteLock
@ -215,7 +215,7 @@ public:
void ReleaseShared();
bool TryAcquireShared();
protected:
std::shared_mutex* _mutex;
std::unique_ptr<std::shared_mutex> _mutex;
};
#endif

View File

@ -350,7 +350,7 @@ asCThreadCriticalSection::asCThreadCriticalSection()
InitializeCriticalSection(&cs);
#endif
#elif defined AS_STD_THREADS
_mutex = new std::mutex();
_mutex = std::make_unique<std::mutex>();
#endif
}
@ -360,8 +360,6 @@ asCThreadCriticalSection::~asCThreadCriticalSection()
pthread_mutex_destroy(&cs);
#elif defined AS_WINDOWS_THREADS
DeleteCriticalSection(&cs);
#elif defined AS_STD_THREADS
delete _mutex;
#endif
}
@ -419,7 +417,7 @@ asCThreadReadWriteLock::asCThreadReadWriteLock()
InitializeCriticalSection(&writeLock);
#endif
#elif defined AS_STD_THREADS
_mutex = new std::shared_mutex();
_mutex = std::make_unique<std::shared_mutex>();
#endif
}
@ -430,8 +428,6 @@ asCThreadReadWriteLock::~asCThreadReadWriteLock()
#elif defined AS_WINDOWS_THREADS
DeleteCriticalSection(&writeLock);
CloseHandle(readLocks);
#elif defined AS_STD_THREADS
delete _mutex;
#endif
}