[*] IncrementAbortFenceOnWorker should support kThreadIdAny

This commit is contained in:
Reece Wilson 2024-01-25 01:08:43 +00:00
parent 9e7615d80c
commit 2b69c07b67

View File

@ -1037,9 +1037,23 @@ namespace Aurora::Async
void ThreadPool::IncrementAbortFenceOnWorker(WorkerId_t workerId)
{
if (auto pState = this->GetThreadHandle(workerId))
auto group = GetGroup(workerId.first);
if (workerId.second == kThreadIdAny)
{
AuAtomicAdd(&pState->shutdown.uShutdownFence, 1u);
AU_LOCK_GUARD(group->workersMutex);
for (auto &[jobWorker, pState]: group->workers)
{
AuAtomicAdd(&pState->shutdown.uShutdownFence, 1u);
}
}
else
{
if (auto pState = this->GetThreadHandle(workerId))
{
AuAtomicAdd(&pState->shutdown.uShutdownFence, 1u);
}
}
}
@ -1085,7 +1099,7 @@ namespace Aurora::Async
bool ThreadPool::Spawn(WorkerId_t workerId, bool create)
{
AU_LOCK_GUARD(rwlock_->AsWritable());
AU_LOCK_GUARD(this->rwlock_->AsWritable());
if (create)
{