[PATCH] D15464: Add a C++11 ThreadPool implementation in LLVM

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 11 13:45:04 PST 2015


joker.eph created this revision.
joker.eph added a reviewer: tejohnson.
joker.eph added a subscriber: llvm-commits.

This is a very simple implementation of a thread pool using C++11
thread. It accepts any std::function<void()> for asynchronous
execution. Individual task can be synchronize using the returned
future, or the client can block on the full queue completion.

In case LLVM is configured with Threading disabled, it falls back
to sequential execution using std::async with launch:deferred.

This is intended to support parallelism for ThinLTO processing in
linker plugin, but is generic enough to be for any other uses.

http://reviews.llvm.org/D15464

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15464.42565.patch
Type: text/x-patch
Size: 10735 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151211/c3c01ca6/attachment.bin>


More information about the llvm-commits mailing list