SDL2: Revert a bad change

--HG--
branch : sdl2
hg/feature/sdl2
kaetemi 11 years ago
parent 788ac7b9e0
commit cd35d14374

@ -33,8 +33,8 @@ class CReaderWriter
{ {
private: private:
volatile CAtomicLock _Fairness; volatile CMutex _Fairness;
volatile CAtomicLock _ReadersMutex; volatile CMutex _ReadersMutex;
volatile CMutex _RWMutex; volatile CMutex _RWMutex;
volatile sint _ReadersLevel; volatile sint _ReadersLevel;
@ -45,29 +45,29 @@ public:
void enterReader() void enterReader()
{ {
const_cast<CAtomicLock&>(_Fairness).enter(); const_cast<CMutex&>(_Fairness).enter();
const_cast<CAtomicLock&>(_ReadersMutex).enter(); const_cast<CMutex&>(_ReadersMutex).enter();
++_ReadersLevel; ++_ReadersLevel;
if (_ReadersLevel == 1) if (_ReadersLevel == 1)
const_cast<CMutex&>(_RWMutex).enter(); const_cast<CMutex&>(_RWMutex).enter();
const_cast<CAtomicLock&>(_ReadersMutex).leave(); const_cast<CMutex&>(_ReadersMutex).leave();
const_cast<CAtomicLock&>(_Fairness).leave(); const_cast<CMutex&>(_Fairness).leave();
} }
void leaveReader() void leaveReader()
{ {
const_cast<CAtomicLock&>(_ReadersMutex).enter(); const_cast<CMutex&>(_ReadersMutex).enter();
--_ReadersLevel; --_ReadersLevel;
if (_ReadersLevel == 0) if (_ReadersLevel == 0)
const_cast<CMutex&>(_RWMutex).leave(); const_cast<CMutex&>(_RWMutex).leave();
const_cast<CAtomicLock&>(_ReadersMutex).leave(); const_cast<CMutex&>(_ReadersMutex).leave();
} }
void enterWriter() void enterWriter()
{ {
const_cast<CAtomicLock&>(_Fairness).enter(); const_cast<CMutex&>(_Fairness).enter();
const_cast<CMutex&>(_RWMutex).enter(); const_cast<CMutex&>(_RWMutex).enter();
const_cast<CAtomicLock&>(_Fairness).leave(); const_cast<CMutex&>(_Fairness).leave();
} }
void leaveWriter() void leaveWriter()

Loading…
Cancel
Save