Replace thread-per-job with a fixed pool of workers: a shared task queue, graceful shutdown, failure accounting, futures for results and a parallel_for.
Workers
A fixed number of threads taking tasks from a shared queue, waiting until idle, surviving exceptions and finishing work on destruction.
Futures and parallel loops
Tasks that return values or exceptions through futures, an emergency stop, and parallel_for.
Work stealing
One queue per worker, with idle workers stealing from busy ones.