diff --git a/Include/auROXTL/auUTF8StringView.hpp b/Include/auROXTL/auUTF8StringView.hpp new file mode 100644 index 00000000..543ef4e0 --- /dev/null +++ b/Include/auROXTL/auUTF8StringView.hpp @@ -0,0 +1,7 @@ +#pragma once + +// TODO: + +using AuUTF8StringView = std::string_view; + +using AuU8View = AuUTF8StringView; \ No newline at end of file diff --git a/Include/auROXTLTypes.hpp b/Include/auROXTLTypes.hpp index 82258be2..64bb8f69 100644 --- a/Include/auROXTLTypes.hpp +++ b/Include/auROXTLTypes.hpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/Source/Loop/LoopQueue.NT.cpp b/Source/Loop/LoopQueue.NT.cpp index 64d6c25e..f9ebaec6 100644 --- a/Source/Loop/LoopQueue.NT.cpp +++ b/Source/Loop/LoopQueue.NT.cpp @@ -521,8 +521,98 @@ namespace Aurora::Loop // Ingore the other unrelated errors (APC notification, timeout, etc) } + // OK - All signals are set + + // Take ownership of the queue ready for a potential purge of objects StartUserAndTakeOwn(); - ConsiderEvicitingTimeoutsAll(); + + // Le great iterate + Iterator queueIterator(this); + AuSInt indexOffset {}; + for (queueIterator.Start(); queueIterator.End() != queueIterator.itr; ) + { + bool shouldRemove {true}; + auto &source = *queueIterator.itr; + + if (source.source) + { + if (source.source->OnTrigger(source.source->Singular() ? source.source->GetHandle() : source.source->GetHandles()[0])) + { + AU_LOCK_GUARD(const_cast(&source.lock)) // this spinlock really does feel like a hack + + for (const auto &handler : source.callbacks.extended) + { + try + { + shouldRemove &= handler->OnFinished(source.source); + } + catch (...) + { + SysPushErrorCatch(); + } + } + + if (shouldRemove) + { + for (const auto &handler : source.callbacks.base) + { + try + { + shouldRemove &= handler->OnFinished(source.source); + } + catch (...) + { + SysPushErrorCatch(); + } + } + } + + if ((source.callbacks.base.empty()) && + (source.callbacks.extended.empty())) + { + shouldRemove = false; + } + } + } + + + if (source.ConsiderTimeout()) + { + shouldRemove = true; + } + + source.source->OnFinishSleep(); + + if (shouldRemove) + { + if (source.source->GetType() == ELoopSource::eSourceWin32) + { + SysPanic("?"); + } + else + { + AuUInt uHandles = (source.source->Singular() ? 1 : source.source->GetHandles().size()); + int sOffset = -(uHandles); + if (this->handleArrayOr_.size() > MAXIMUM_WAIT_OBJECTS) + { + this->RemoveSourceNB(source.source); + this->willCommitInFuture_ = true; + } + else + { + AuRemoveRange(this->handleArrayOr_, queueIterator.startingIndexOr + indexOffset, uHandles); + AuRemoveRange(this->handleArrayAnd_, queueIterator.startingIndexAnd + indexOffset, uHandles); + queueIterator.Delete(this->loopSourceExs_.erase(queueIterator.itr)); + continue; + } + } + } + //else + { + queueIterator.Next(); + } + } + StartUserAndTakeOwn_Release(); return bReturnStatus; @@ -745,21 +835,21 @@ namespace Aurora::Loop AU_LOCK_GUARD(const_cast(&source.lock)) // this spinlock really does feel like a hack - for (const auto &handler : source.callbacks.base) + for (const auto &handler : source.callbacks.extended) + { + try { - try - { - shouldRemove &= handler->OnFinished(source.source); - } - catch (...) - { - SysPushErrorCatch(); - } + shouldRemove &= handler->OnFinished(source.source); } + catch (...) + { + SysPushErrorCatch(); + } + } if (shouldRemove) { - for (const auto &handler : source.callbacks.extended) + for (const auto &handler : source.callbacks.base) { try {