[*] Stupid optimization that doesn't make so much of a difference
This commit is contained in:
parent
76c4759f92
commit
2eb5c97800
@ -529,6 +529,7 @@ namespace Aurora::Loop
|
||||
// Le great iterate
|
||||
Iterator queueIterator(this);
|
||||
AuSInt indexOffset {};
|
||||
auto now = AuTime::CurrentInternalClockMS();
|
||||
for (queueIterator.Start(); queueIterator.End() != queueIterator.itr; )
|
||||
{
|
||||
bool shouldRemove {true};
|
||||
@ -576,7 +577,7 @@ namespace Aurora::Loop
|
||||
}
|
||||
|
||||
|
||||
if (!shouldRemove && source.ConsiderTimeout())
|
||||
if (!shouldRemove && source.ConsiderTimeout(now))
|
||||
{
|
||||
shouldRemove = true;
|
||||
}
|
||||
@ -791,6 +792,7 @@ namespace Aurora::Loop
|
||||
{
|
||||
Iterator queueIterator(this);
|
||||
AuSInt indexOffset {};
|
||||
auto now = AuTime::CurrentInternalClockMS();
|
||||
for (queueIterator.Start(); queueIterator.End() != queueIterator.itr; )
|
||||
{
|
||||
bool shouldRemove {false};
|
||||
@ -879,7 +881,7 @@ namespace Aurora::Loop
|
||||
}
|
||||
else
|
||||
{
|
||||
if (source.ConsiderTimeout())
|
||||
if (source.ConsiderTimeout(now))
|
||||
{
|
||||
shouldRemove = true;
|
||||
}
|
||||
@ -1009,11 +1011,12 @@ namespace Aurora::Loop
|
||||
Iterator queueIterator(this);
|
||||
bool bRebuildFromAnd {};
|
||||
|
||||
auto now = AuTime::CurrentInternalClockMS();
|
||||
for (queueIterator.Start(); queueIterator.End() != queueIterator.itr; )
|
||||
{
|
||||
|
||||
auto &source = *queueIterator.itr;
|
||||
if (!source.ConsiderTimeout())
|
||||
if (!source.ConsiderTimeout(now))
|
||||
{
|
||||
queueIterator.Next();
|
||||
source.source->OnFinishSleep();
|
||||
|
@ -63,9 +63,9 @@ namespace Aurora::Loop
|
||||
AuUInt32 timeoutAbs;
|
||||
SourceCallbacks callbacks;
|
||||
|
||||
bool ConsiderTimeout() const
|
||||
bool ConsiderTimeout(AuUInt64 time) const
|
||||
{
|
||||
if ((timeoutAbs) && (AuTime::CurrentInternalClockMS() >= timeoutAbs))
|
||||
if ((timeoutAbs) && (time >= timeoutAbs))
|
||||
{
|
||||
for (const auto &handler : callbacks.extended)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user