Core/TaskScheduler: Fix work ending condition
Use remaining task count instead of idle worker count, this avoids a race condition where a worker signals idle after being tasked with a new job
This commit is contained in:
@@ -40,11 +40,10 @@ namespace Nz
|
||||
friend Worker;
|
||||
|
||||
Worker& GetWorker(unsigned int workerIndex);
|
||||
void NotifyWorkerActive();
|
||||
void NotifyWorkerIdle();
|
||||
void NotifyTaskCompletion();
|
||||
|
||||
std::atomic_bool m_idle;
|
||||
std::atomic_uint m_idleWorkerCount;
|
||||
std::atomic_uint m_remainingTasks;
|
||||
std::size_t m_nextWorkerIndex;
|
||||
std::vector<Worker> m_workers;
|
||||
MemoryPool<Task> m_tasks;
|
||||
|
||||
Reference in New Issue
Block a user