[*] bug: drop limitation in io processor

[*] attempting to mitigate freeze on remote start watch
This commit is contained in:
Reece Wilson 2023-11-05 03:31:54 +00:00
parent 028c85e4c8
commit dcb27645a1
7 changed files with 30 additions and 21 deletions

View File

@ -76,13 +76,7 @@ namespace Aurora::Async
} }
AuAtomicAdd(&pWorker->cvHasWork, 1u); AuAtomicAdd(&pWorker->cvHasWork, 1u);
pWorker->SetEvent();
pWorker->cvVariable->Broadcast();
if (auto pEventLS = pWorker->eventLs)
{
pEventLS->Set();
}
} }
} }

View File

@ -160,10 +160,7 @@ namespace Aurora::Async
pWorker->cvVariable->Signal(); pWorker->cvVariable->Signal();
} }
if (AuAtomicTestAndSet(&pWorker->cvLSActive, 0u) == 0) pWorker->SetEvent(false);
{
pWorker->eventLs->Set();
}
} }
} }

View File

@ -75,6 +75,22 @@ namespace Aurora::Async
AuSPtr<AuLoop::ILSEvent> eventLs; AuSPtr<AuLoop::ILSEvent> eventLs;
AuSPtr<AuLoop::ILoopSource> asyncLoopSourceShared; AuSPtr<AuLoop::ILoopSource> asyncLoopSourceShared;
inline void SetEvent(bool bBoth = true)
{
if (auto pEvent = this->eventLs)
{
if (AuAtomicTestAndSet(&this->cvLSActive, 0u) == 0)
{
pEvent->Set();
}
}
if (bBoth)
{
this->cvVariable->Signal();
}
}
// //
AuUInt32 uShutdownFence { 1 }; AuUInt32 uShutdownFence { 1 };
}; };

View File

@ -17,7 +17,7 @@ namespace Aurora::Async
{ {
if (LoopQueue::Commit()) if (LoopQueue::Commit())
{ {
this->commitPending_ = false; AuAtomicSub(&this->commitPending_, 1u);
} }
} }
} }
@ -54,11 +54,17 @@ namespace Aurora::Async
void AsyncLoop::Schedule() void AsyncLoop::Schedule()
{ {
this->commitPending_ = true;
if (AuThreads::GetThread() != this->pParent->threadObject.get()) if (AuThreads::GetThread() != this->pParent->threadObject.get())
{ {
this->pParent->cvVariable->Broadcast(); AuAtomicAdd(&this->commitPending_, 1u);
{
AU_LOCK_GUARD(this->pParent->parent.lock()->workQueue.mutex);
this->pParent->SetEvent();
}
}
else
{
this->commitPending_ = 1;
} }
} }

View File

@ -26,6 +26,6 @@ namespace Aurora::Async
bool CommitPending(); bool CommitPending();
private: private:
bool commitPending_ {}; AuUInt32 commitPending_ {};
}; };
} }

View File

@ -728,11 +728,6 @@ namespace Aurora::IO
const AuSPtr<IIOEventListener> &pListener, const AuSPtr<IIOEventListener> &pListener,
bool bSingleshot) bool bSingleshot)
{ {
if (!CheckThread())
{
AU_THROW_STRING("Wrong Thread");
}
auto item = AuMakeShared<IOProcessorItem>(); auto item = AuMakeShared<IOProcessorItem>();
if (!item) if (!item)
{ {

View File

@ -375,6 +375,7 @@ namespace Aurora::IO::Loop
try try
{ {
AU_DEBUG_MEMCRUNCH; AU_DEBUG_MEMCRUNCH;
AU_LOCK_GUARD(this->sourceMutex_);
bool bShouldRebuild {}; bool bShouldRebuild {};