[PATCH] D25784: [Support] ThreadPool: Don't spawn any threads when ThreadCount = 1

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 19 12:58:12 PDT 2016

vsk added a comment.

In https://reviews.llvm.org/D25784#574641, @mehdi_amini wrote:

> That seems fine and makes sense to me from an API point of view.
>  I'm not sure how to translate this to the user though: I don't expect someone to run `-threads=0`. And we're back to special casing in the client: `ThreadPool Pool(ThreadCount == 1 ? 0 : ThreadCount);` which isn't great either.

Good point. Wdyt of adding 'bool PreferSequential = false' to the constructors? The meaning of 'PreferSequential' would be `ThreadCount = (PreferSequential && MaxThreadCount == 1) ? 0 : MaxThreadCount`. That way, users can opt-in to executing all the tasks in wait().


More information about the llvm-commits mailing list