[*] NT AuThreadPrimitives: stop using these AuProcAddresses directly

This commit is contained in:
Reece Wilson 2023-09-09 12:29:43 +01:00
parent 8e59300395
commit 9601fcfd39
6 changed files with 30 additions and 8 deletions

View File

@ -10,11 +10,21 @@
namespace Aurora::Threading
{
// Buttered up native high-res wait for change API:
bool InternalLTSWaitOnAddressHighRes(void *pTargetAddress,
const void *pCompareAddress,
AuUInt8 uWordSize,
AuUInt64 qwNanosecondsAbs);
// ...cont
void InternalLTSWakeAll(const void *pTargetAddress);
// ...cont
void InternalLTSWakeOne(const void *pTargetAddress);
// extra wrapping for use with primitives when expecting less scheduler indirection
// (its good to avoid the emulation layer in the slow paths of high level primitives)
static bool InternalLTSWaitOnAddressHighRes(volatile void *pTargetAddress,
const void *pCompareAddress,
AuUInt8 uWordSize,

View File

@ -795,6 +795,18 @@ namespace Aurora::Threading
}
}
void InternalLTSWakeAll(const void *pTargetAddress)
{
auto [pWakeAddress, uDelta, uMask] = DecodeAddress(pTargetAddress, 1);
RunOSWakeAllOnAddress(pWakeAddress);
}
void InternalLTSWakeOne(const void *pTargetAddress)
{
auto [pWakeAddress, uDelta, uMask] = DecodeAddress(pTargetAddress, 1);
RunOSWakeNOnAddress(pWakeAddress, uDelta ? INT_MAX : 1);
}
AUKN_SYM bool WaitOnAddress(const void *pTargetAddress,
const void *pCompareAddress,
AuUInt8 uWordSize,

View File

@ -126,7 +126,7 @@ namespace Aurora::Threading::Primitives
{
if (AuAtomicCompareExchange(&uValueRef, uValue - kFutexBitWait, uValue) == uValue)
{
pWakeByAddressSingle((void *)&uValueRef);
InternalLTSWakeOne((void *)&uValueRef);
return;
}
}

View File

@ -118,7 +118,7 @@ namespace Aurora::Threading::Primitives
}
AuUInt8 uBlockBit { 1 };
pWakeByAddressAll((void *)&this->wlist); // this is kinda sad
InternalLTSWakeAll((void *)&this->wlist); // this is kinda sad
bRet = InternalLTSWaitOnAddressHighRes(&this->wlist, &uBlockBit, 1, uEndTimeSteady); // why?
}
else
@ -332,7 +332,7 @@ namespace Aurora::Threading::Primitives
{
if (gUseNativeWaitCondvar)
{
pWakeByAddressSingle((void *)&this->wlist);
InternalLTSWakeOne((void *)&this->wlist);
}
else
{
@ -376,7 +376,7 @@ namespace Aurora::Threading::Primitives
expected - uAwoken,
original) == original)
{
pWakeByAddressAll((void *)&this->wlist);
InternalLTSWakeAll((void *)&this->wlist);
return;
}
else

View File

@ -255,7 +255,7 @@ namespace Aurora::Threading::Primitives
if (AuAtomicCompareExchange(&uValueRef, uValue - kFutexBitWait, uValue) == uValue)
{
pWakeByAddressSingle((void *)&this->state_);
InternalLTSWakeOne((void *)&this->state_);
return;
}
@ -327,7 +327,7 @@ namespace Aurora::Threading::Primitives
{
if (AuAtomicCompareExchange(&uValueRef, uValue - kFutexBitWait, uValue) == uValue)
{
pWakeByAddressSingle((void *)&this->state_);
InternalLTSWakeOne((void *)&this->state_);
return;
}
}

View File

@ -221,11 +221,11 @@ namespace Aurora::Threading::Primitives
{
if (count == 1)
{
pWakeByAddressSingle((void *)&this->dwState_);
InternalLTSWakeOne((void *)&this->dwState_);
}
else
{
pWakeByAddressAll((void *)&this->dwState_);
InternalLTSWakeAll((void *)&this->dwState_);
}
}
}