[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 11:55:26 PDT 2016


vsk created this revision.
vsk added reviewers: joker-eph, tejohnson.
vsk added a subscriber: llvm-commits.

This should save clients the time/memory overhead of spawning a thread when ThreadCount/std::thread::hardware_concurrency() = 1. IMO this is also a de facto simplification of the ThreadPool API, because clients no longer have to maintain slightly separate code paths for the ThreadCount = 1 / ThreadCount > 1 cases.

Tested by running unittests/Support/SupportTests configured with -DLLVM_ENABLE_THREADS={On,Off}.


https://reviews.llvm.org/D25784

Files:
  include/llvm/Support/ThreadPool.h
  lib/Support/ThreadPool.cpp
  unittests/Support/ThreadPool.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25784.75185.patch
Type: text/x-patch
Size: 6120 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161019/e6ac452f/attachment.bin>


More information about the llvm-commits mailing list