Constructor
Create a task from delegate
Create a task from function pointer
Returns true if all tasks are finished
import std.stdio; int x = 0; int y = 0; void task1() { while(x < 100) x += 1; } void task2() { while(y < 100) y += 1; } ThreadPool threadPool = New!ThreadPool(2); threadPool.submit(&task1); threadPool.submit(&task2); while(!threadPool.tasksDone) {} if (x != 100) writeln(x); if (y != 100) writeln(y); assert(x == 100); assert(y == 100); Delete(threadPool);
An object that manages worker threads and runs tasks on them