[all-commits] [llvm/llvm-project] 6149e5: [ThreadPool] Support returning futures with results.
Florian Hahn via All-commits
all-commits at lists.llvm.org
Mon Nov 22 13:21:33 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 6149e57dc1313d32c85524f8009a1249e0b8f4d1
https://github.com/llvm/llvm-project/commit/6149e57dc1313d32c85524f8009a1249e0b8f4d1
Author: Florian Hahn <flo at fhahn.com>
Date: 2021-11-22 (Mon, 22 Nov 2021)
Changed paths:
M llvm/include/llvm/Support/ThreadPool.h
M llvm/lib/Support/ThreadPool.cpp
M llvm/unittests/Support/ThreadPool.cpp
Log Message:
-----------
[ThreadPool] Support returning futures with results.
This patch adjusts ThreadPool::async to return futures that wrap
the result type of the passed in callable.
To do so, ThreadPool::asyncImpl first creates a shared promise. The
result of the promise is set in a new callable that first executes the
task. The callable is added to the task queue.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D114183
More information about the All-commits
mailing list