[*] Fix bugs in the partially rewritten async scheduler
This commit is contained in:
parent
8b4ad9795c
commit
e853b44ee6
@ -50,6 +50,7 @@ namespace Aurora::Async
|
||||
|
||||
if (ns > time)
|
||||
{
|
||||
SchedNextTime(ns);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -79,8 +80,6 @@ namespace Aurora::Async
|
||||
|
||||
static void SchedNextTime(AuUInt64 uNSAbs)
|
||||
{
|
||||
bool bForceWakeup {};
|
||||
|
||||
if (uNextSysTickGuessed > uNSAbs ||
|
||||
!uNextSysTickGuessed)
|
||||
{
|
||||
@ -99,21 +98,13 @@ namespace Aurora::Async
|
||||
uNSAbs = uNextWakeuptimeRateLimit;
|
||||
}
|
||||
|
||||
if (!uCurrent)
|
||||
{
|
||||
bForceWakeup = true;
|
||||
}
|
||||
|
||||
if (AuAtomicCompareExchange(&uNextSysTickGuessed, uNSAbs, uCurrent) == uCurrent)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bForceWakeup)
|
||||
{
|
||||
gSchedCondvar->Signal();
|
||||
}
|
||||
gSchedCondvar->Signal();
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,15 +127,15 @@ namespace Aurora::Async
|
||||
|
||||
if (uNow < uNextTick)
|
||||
{
|
||||
uNextSysTickGuessed = 0;
|
||||
gSchedCondvar->WaitForSignalNS(uNextTick - uNow);
|
||||
}
|
||||
else if (uNow == uNextTick)
|
||||
else if (uNow >= uNextTick)
|
||||
{
|
||||
uNextSysTickGuessed = 0;
|
||||
}
|
||||
else
|
||||
else if (uNextSysTickGuessed == 0)
|
||||
{
|
||||
uNextSysTickGuessed = 0;
|
||||
gSchedCondvar->WaitForSignalNS(gRuntimeConfig.async.bEnableLegacyTicks ?
|
||||
AuMSToNS<AuUInt64>(gRuntimeConfig.async.dwLegacyMainThreadSystemTickMS) :
|
||||
0);
|
||||
@ -278,7 +269,7 @@ namespace Aurora::Async
|
||||
}
|
||||
else
|
||||
{
|
||||
itr ++;
|
||||
itr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user