[*] WoA fixes

This commit is contained in:
Reece Wilson 2023-12-10 18:21:35 +00:00
parent fc6902d231
commit 3f43c320c5
2 changed files with 30 additions and 3 deletions

View File

@ -106,7 +106,14 @@ namespace Aurora::Threading
Win32DropSchedulerResolution();
#endif
this->variable.WaitForSignalNsEx(&this->mutex, uTimeRemNS);
if (!this->bAlive)
{
(void)gProcessWaitables.WaitBufferFrom(this->pAddress, this->uSize);
}
else
{
this->variable.WaitForSignalNsEx(&this->mutex, uTimeRemNS);
}
uNow = AuTime::SteadyClockNS();
}
@ -117,7 +124,14 @@ namespace Aurora::Threading
{
while (WaitBuffer::Compare(this->pAddress, this->uSize, state))
{
this->variable.WaitForSignalNsEx(&this->mutex, 0);
if (!this->bAlive)
{
(void)gProcessWaitables.WaitBufferFrom(this->pAddress, this->uSize);
}
else
{
this->variable.WaitForSignalNsEx(&this->mutex, 0);
}
}
return true;
@ -211,6 +225,7 @@ namespace Aurora::Threading
pReturn->pAddress = pAddress;
pReturn->uSize = uSize;
pReturn->bAlive = true;
{
Lock();
@ -275,6 +290,8 @@ namespace Aurora::Threading
{
this->waitList.pTail = pCurrentHead->pBefore;
}
pCurrentHead->bAlive = false;
}
if (!bCont)
@ -328,6 +345,7 @@ namespace Aurora::Threading
this->waitList.pTail = pCurrentHead->pBefore;
}
pCurrentHead->bAlive = false;
break;
}
@ -989,6 +1007,14 @@ namespace Aurora::Threading
AuUInt64 qwNanoseconds,
AuOptional<bool> optAlreadySpun)
{
// Avoid emulated path dynamic TLS fetch without TLS section
// or various security checks
// or other such bloated thunks
if (!WaitBuffer::Compare(pCompareAddress, uWordSize, pTargetAddress))
{
return true;
}
bool bWaitOnAddress = IsWaitOnRecommended();
if (bWaitOnAddress)
{
@ -1036,7 +1062,7 @@ namespace Aurora::Threading
}
}
return WaitOnAddressWide(pTargetAddress, pCompareAddress, uWordSize, {}, qwNanoseconds, false);
return WaitOnAddressWide(pTargetAddress, pCompareAddress, uWordSize, {}, qwNanoseconds ? qwNanoseconds : AuOptional<AuUInt64>{}, false);
}
return false;

View File

@ -56,6 +56,7 @@ namespace Aurora::Threading
// bookkeeping (parent container)
bool bOverflow {};
bool bAlive {};
void Release();