[*] Caught an issue with RWLock: cant reenter unlocked reentrance mutex.

This commit is contained in:
Reece Wilson 2023-08-21 15:39:56 +01:00
parent 631ffab1a2
commit d1b1bfb221

View File

@ -365,8 +365,21 @@ namespace Aurora::Threading::Primitives
{
AuInt32 val {};
// love me cas
{
AuInt32 curVal {};
do
{
curVal = this->state_;
if (curVal != -1)
{
continue;
}
this->reentrantWriteLockHandle_ = 0;
val = AuAtomicAdd(&this->state_, 1);
}
while (AuAtomicCompareExchange(&this->state_, val = (curVal + 1), curVal) != curVal);
}
if (val == 0)
{