updated job system dispatch()

This commit is contained in:
Turanszki Janos
2018-11-05 22:33:55 +00:00
parent b6287eccea
commit 28bcab7146
6 changed files with 88 additions and 160 deletions
+3 -2
View File
@@ -9,12 +9,13 @@ namespace wiJobSystem
uint32_t GetThreadCount();
// Add a job to execute asynchronously. Any idle thread will execute this job.
void Execute(const std::function<void()>& func);
void Execute(const std::function<void()>& job);
// Divide a job onto multiple jobs and execute in parallel.
// jobCount : how many jobs to generate for this task.
// groupSize : how many jobs to execute per thread. Jobs inside a group execute serially. It might be worth to increase for small jobs
// func : receives the job invocation index (0, 1, ... jobCount) as lambda argument
void Dispatch(uint32_t jobCount, const std::function<void(uint32_t jobIndex)>& func);
void Dispatch(uint32_t jobCount, uint32_t groupSize, const std::function<void(uint32_t jobIndex)>& job);
// Check if any threads are working currently or not
bool IsBusy();