[*] caught async deinit deadlock

featues conflicting with idec what. this mess needs rewriting
This commit is contained in:
Reece Wilson 2023-10-01 17:10:48 +01:00
parent cdad552ed0
commit a60e740328
2 changed files with 9 additions and 5 deletions

View File

@ -1000,7 +1000,9 @@ namespace Aurora::Async
{
auto pWorkItem = DispatchOn({ this->SharedFromThis(), id }, [=]()
{
GetThreadState()->features.push_back(pFeature);
auto pState = GetThreadState();
AU_LOCK_GUARD(pState->featuresMutex);
pState->features.push_back(pFeature);
pFeature->Init();
});
@ -1413,9 +1415,7 @@ namespace Aurora::Async
AuList<AuSPtr<AuThreads::IThreadFeature>> features;
{
AU_LOCK_GUARD(this->rwlock_->AsReadable()); // WARNING: this should be write, but im seeing a deadlock on exit
// there is no real race condition to be concerned about
// AsReadable shouldn't be enterable while someone is writing (the other accessor)
AU_LOCK_GUARD(jobWorker->featuresMutex);
features = AuExchange(jobWorker->features, {});
}
@ -1476,7 +1476,10 @@ namespace Aurora::Async
jobWorker->externalFences.clear();
}
features = AuExchange(jobWorker->features, {});
{
AU_LOCK_GUARD(jobWorker->featuresMutex);
features = AuExchange(jobWorker->features, {});
}
}
{

View File

@ -43,6 +43,7 @@ namespace Aurora::Async
AuWPtr<GroupState> parent;
AuThreadPrimitives::Semaphore syncSema;
AuThreadPrimitives::Event isDeadEvent;
AuMutex featuresMutex;
AuList<AuSPtr<AuThreads::IThreadFeature>> features;
bool rejecting {};
bool exiting {};