Switching back to std::thread to simplify the logic, as ThreadPool adds a layer of task management. However, keeping the ThreadPoolStrategy use, to benefit the ThreadPool improvements from https://reviews.llvm.org/D71775
This patch partly reverts https://reviews.llvm.org/D74569
Added a few optimizations:
- Prevent from spawning more threads than there are files to process;
- Perform computations on the main thread too, to save one thread spawn. This way, clang-scan-deps -j1 will be really single-threaded, and the code path is the same as when LLVM threads are disabled.
- Call reserve() to std::vectors which size is known when initializing.