[*] AuAsync shutdown is still a mess

This commit is contained in:
Reece Wilson 2023-08-10 01:20:34 +01:00
parent 7865749348
commit 7dda7ae358
3 changed files with 1 additions and 36 deletions

View File

@ -243,11 +243,6 @@ namespace Aurora::Async
gThread->Run();
}
void StopSched()
{
DeinitSched();
}
bool Schedule(AuUInt64 ns, IThreadPoolInternal *pool,
WorkerId_t target,
AuSPtr<IAsyncRunnable> runnable)

View File

@ -14,7 +14,6 @@ namespace Aurora::Async
void InitSched();
void DeinitSched();
void StartSched();
void StopSched();
bool Schedule(AuUInt64 ns, IThreadPoolInternal *pool, WorkerId_t target, AuSPtr<IAsyncRunnable> runnable);
void TerminateSceduledTasks(IThreadPoolInternal *pool, WorkerId_t target);

View File

@ -614,19 +614,11 @@ namespace Aurora::Async
auto pLocalRunner = this->GetThreadStateNoWarn();
AuList<WorkerId_t> toBarrier;
// Noting
// 1) that StopSched may lockup under a writable lock
// -> we will terminate a thread that may be dispatching a sys pump event
// 2) that barrier doesn't need to be under a write lock
//
// Perform the following shutdown of the schedular and other available threads under a read lock
{
{
{
AU_LOCK_GUARD(this->rwlock_->AsReadable());
StopSched();
for (auto &[groupId, group] : this->threads_)
{
for (auto &[id, worker] : group->workers)
@ -642,10 +634,6 @@ namespace Aurora::Async
}
// Ehhhh
// We need this fix to a specific V8 deinit lockup
//this->Poll();
for (const auto &id : toBarrier)
{
if (trySelfPid == id)
@ -1307,23 +1295,6 @@ namespace Aurora::Async
jobWorker->isDeadEvent->Set();
if (!this->GetThreadState()->bIsKiller)
{
AU_LOCK_GUARD(this->rwlock_->AsReadable());
#if 0
// TODO... i know what to do
#else
//// this will do for now
//if (!jobWorker->rejecting &&
// !this->shutdown)
//{
// this->Barrier(AuAsync::GetCurrentWorkerPId(), 0, false , true);
//}
////this->Barrier(AuAsync::GetCurrentWorkerPId(), 0, false, false);
// UPDATE: 2023
// TODO: regressed - it wont do
#endif
}
jobWorker->bAlreadyDoingExitTick = false;
jobWorker->bBreakEarly = true;