Revert "Attempt at fixing segfault with new std threads impl"
This reverts commit ee2f629911
.
This commit is contained in:
parent
9c84058e1b
commit
54efff6251
|
@ -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
|
||||
|
|
|
@ -349,8 +349,6 @@ asCThreadCriticalSection::asCThreadCriticalSection()
|
|||
// MinGW also only defines this version
|
||||
InitializeCriticalSection(&cs);
|
||||
#endif
|
||||
#elif defined AS_STD_THREADS
|
||||
_mutex = std::make_unique<std::mutex>();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -370,7 +368,7 @@ void asCThreadCriticalSection::Enter()
|
|||
#elif defined AS_WINDOWS_THREADS
|
||||
EnterCriticalSection(&cs);
|
||||
#elif defined(AS_STD_THREADS)
|
||||
_mutex->lock();
|
||||
_mutex.lock();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -381,7 +379,7 @@ void asCThreadCriticalSection::Leave()
|
|||
#elif defined AS_WINDOWS_THREADS
|
||||
LeaveCriticalSection(&cs);
|
||||
#elif defined(AS_STD_THREADS)
|
||||
_mutex->unlock();
|
||||
_mutex.unlock();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -392,7 +390,7 @@ bool asCThreadCriticalSection::TryEnter()
|
|||
#elif defined AS_WINDOWS_THREADS
|
||||
return TryEnterCriticalSection(&cs) ? true : false;
|
||||
#elif defined(AS_STD_THREADS)
|
||||
return _mutex->try_lock();
|
||||
return _mutex.try_lock();
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
|
@ -416,8 +414,6 @@ asCThreadReadWriteLock::asCThreadReadWriteLock()
|
|||
readLocks = CreateSemaphoreW(NULL, maxReaders, maxReaders, 0);
|
||||
InitializeCriticalSection(&writeLock);
|
||||
#endif
|
||||
#elif defined AS_STD_THREADS
|
||||
_mutex = std::make_unique<std::shared_mutex>();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -450,7 +446,7 @@ void asCThreadReadWriteLock::AcquireExclusive()
|
|||
// lock the readers when this writer releases them anyway.
|
||||
LeaveCriticalSection(&writeLock);
|
||||
#elif defined(AS_STD_THREADS)
|
||||
_mutex->lock();
|
||||
_mutex.lock();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -462,7 +458,7 @@ void asCThreadReadWriteLock::ReleaseExclusive()
|
|||
// Release all readers at once
|
||||
ReleaseSemaphore(readLocks, maxReaders, 0);
|
||||
#elif defined(AS_STD_THREADS)
|
||||
_mutex->unlock();
|
||||
_mutex.unlock();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -474,7 +470,7 @@ void asCThreadReadWriteLock::AcquireShared()
|
|||
// Lock a reader slot
|
||||
WaitForSingleObjectEx(readLocks, INFINITE, FALSE);
|
||||
#elif defined(AS_STD_THREADS)
|
||||
_mutex->lock_shared();
|
||||
_mutex.lock_shared();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -486,7 +482,7 @@ void asCThreadReadWriteLock::ReleaseShared()
|
|||
// Release the reader slot
|
||||
ReleaseSemaphore(readLocks, 1, 0);
|
||||
#elif defined(AS_STD_THREADS)
|
||||
_mutex->unlock_shared();
|
||||
_mutex.unlock_shared();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue