Further attempts at fixing segfault in locks
This commit is contained in:
parent
ee2f629911
commit
dd93ba7ec4
|
@ -198,7 +198,7 @@ public:
|
|||
bool TryEnter();
|
||||
|
||||
protected:
|
||||
std::unique_ptr<std::mutex> _mutex;
|
||||
std::mutex* _mutex;
|
||||
};
|
||||
|
||||
class asCThreadReadWriteLock
|
||||
|
@ -215,7 +215,7 @@ public:
|
|||
void ReleaseShared();
|
||||
bool TryAcquireShared();
|
||||
protected:
|
||||
std::unique_ptr<std::shared_mutex> _mutex;
|
||||
std::shared_mutex* _mutex;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -350,7 +350,7 @@ asCThreadCriticalSection::asCThreadCriticalSection()
|
|||
InitializeCriticalSection(&cs);
|
||||
#endif
|
||||
#elif defined AS_STD_THREADS
|
||||
_mutex = std::make_unique<std::mutex>();
|
||||
_mutex = new std::mutex();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -360,6 +360,8 @@ asCThreadCriticalSection::~asCThreadCriticalSection()
|
|||
pthread_mutex_destroy(&cs);
|
||||
#elif defined AS_WINDOWS_THREADS
|
||||
DeleteCriticalSection(&cs);
|
||||
#elif defined AS_STD_THREADS
|
||||
delete _mutex;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -417,7 +419,7 @@ asCThreadReadWriteLock::asCThreadReadWriteLock()
|
|||
InitializeCriticalSection(&writeLock);
|
||||
#endif
|
||||
#elif defined AS_STD_THREADS
|
||||
_mutex = std::make_unique<std::shared_mutex>();
|
||||
_mutex = new std::shared_mutex();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -428,6 +430,8 @@ asCThreadReadWriteLock::~asCThreadReadWriteLock()
|
|||
#elif defined AS_WINDOWS_THREADS
|
||||
DeleteCriticalSection(&writeLock);
|
||||
CloseHandle(readLocks);
|
||||
#elif defined AS_STD_THREADS
|
||||
delete _mutex;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue