[PATCH] D87467: [Support] Use unique_function rather than std::function for ThreadPool TaskTy.
Lang Hames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 10:08:35 PDT 2020
lhames created this revision.
lhames added reviewers: dblaikie, chandlerc, mehdi_amini.
Herald added a subscriber: ributzka.
Herald added a project: LLVM.
lhames requested review of this revision.
This will allow non-copyable function objects (e.g. lambdas that capture
unique_ptrs) to be used with ThreadPool.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D87467
Files:
llvm/include/llvm/Support/ThreadPool.h
Index: llvm/include/llvm/Support/ThreadPool.h
===================================================================
--- llvm/include/llvm/Support/ThreadPool.h
+++ llvm/include/llvm/Support/ThreadPool.h
@@ -13,6 +13,7 @@
#ifndef LLVM_SUPPORT_THREAD_POOL_H
#define LLVM_SUPPORT_THREAD_POOL_H
+#include "llvm/ADT/FunctionExtras.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/Threading.h"
#include "llvm/Support/thread.h"
@@ -36,7 +37,7 @@
/// for some work to become available.
class ThreadPool {
public:
- using TaskTy = std::function<void()>;
+ using TaskTy = unique_function<void()>;
using PackagedTaskTy = std::packaged_task<void()>;
/// Construct a pool using the hardware strategy \p S for mapping hardware
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87467.291013.patch
Type: text/x-patch
Size: 744 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200910/d6ceff90/attachment.bin>
More information about the llvm-commits
mailing list