[*] WaitOnAddress: fix non-special (multiple under 1 head) cannot be referenced during an unlink of a nonspecial (traditional / fast) collision resulting in a SysUnreachable

This commit is contained in:
Reece Wilson 2024-12-27 14:44:55 +00:00
parent e6c2a5c9de
commit 95ef4eed93

View File

@ -347,7 +347,7 @@ namespace Aurora::Threading
return nullptr;
}
}
else
else AU_EOB_UNLIKELY
{
// old logic / no wait multiple: traverse backwards
return this->pBefore;
@ -356,7 +356,7 @@ namespace Aurora::Threading
void WaitEntry::SetBefore(const void *pAddress, WaitEntry *pNext)
{
if (auto pSpecial = this->pSpecial)
if (auto pSpecial = this->pSpecial) AU_EOB_UNLIKELY
{
if (auto pNextEntry = GetPBeforeFromContainer(pSpecial, pAddress))
{
@ -364,7 +364,14 @@ namespace Aurora::Threading
}
else
{
SysUnreachable();
if (auto ppBeforeHead = GetPFirstFromContainer(pSpecial, pAddress))
{
*ppBeforeHead = pNext;
}
else AU_EOB_UNLIKELY
{
SysUnreachable();
}
}
}
else
@ -375,7 +382,7 @@ namespace Aurora::Threading
WaitEntry *WaitEntry::GetNext(const void *pAddress)
{
if (auto pSpecial = this->pSpecial)
if (auto pSpecial = this->pSpecial) AU_EOB_UNLIKELY
{
return *GetPNextFromContainer(pSpecial, pAddress);
}
@ -398,7 +405,7 @@ namespace Aurora::Threading
return nullptr;
}
}
else
else AU_EOB_UNLIKELY
{
return this->pNext;
}
@ -406,15 +413,22 @@ namespace Aurora::Threading
void WaitEntry::SetNext(const void *pAddress, WaitEntry *pNext)
{
if (auto pSpecial = this->pSpecial)
if (auto pSpecial = this->pSpecial) AU_EOB_UNLIKELY
{
if (auto pNextEntry = GetPNextFromContainer(pSpecial, pAddress))
{
*pNextEntry = pNext;
}
else
else AU_EOB_UNLIKELY
{
SysUnreachable();
if (auto ppNextHead = GetPLastFromContainer(pSpecial, pAddress))
{
*ppNextHead = pNext;
}
else
{
SysUnreachable();
}
}
}
else