This commit is contained in:
Reece Wilson 2022-01-19 11:47:29 +00:00
parent 6135618e24
commit f1040a67b0
2 changed files with 7 additions and 3 deletions

View File

@ -60,8 +60,7 @@ namespace Aurora::Async
template<typename Info_t = AVoid, typename Result_t = AVoid, typename Task_t = FTask<Info_t, Result_t>, typename Job_t = FJob<Info_t, Result_t>, class a = const Job_t &, class b = Task_t &, class WorkerId_tt = WorkerId_t, AU_TEMPLATE_ENABLE_WHEN(std::is_same_v<WorkerId_tt, WorkerId_t>)>
static AuSPtr<IWorkItem> NewWork(const WorkerId_tt &worker, a task, b job, bool enableWait = false)
{
auto baa = AuMakeShared<WorkPairImpl<Info_t, Result_t, Task_t>>(task, job);
return NewWorkItem(worker, baa, enableWait);
return NewWorkItem(worker, AuMakeShared<WorkPairImpl<Info_t, Result_t, Task_t>>(task, job), enableWait);
}
template<typename Info_t = AVoid, typename Result_t = AVoid, typename Task_t = FTask<Info_t, Result_t>, typename Job_t = FJob<Info_t, Result_t>, class a = const Job_t &, class b = Task_t &, class WorkerId_tt = WorkerId_t, AU_TEMPLATE_ENABLE_WHEN(std::is_same_v<WorkerId_tt, WorkerId_t>)>

View File

@ -577,11 +577,16 @@ namespace Aurora::Async
{
for (auto &[id, worker] : group->workers)
{
if (group->cvWorkMutex && group->cvVariable)
{
AU_LOCK_GUARD(group->cvWorkMutex);
worker->shuttingdown = true;
group->cvVariable->Broadcast();
}
else
{
worker->shuttingdown = true;
}
if (groupId != 0)
{