[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:18:22 PDT 2020
lhames updated this revision to Diff 291020.
lhames added a comment.
Add a unit test.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87467/new/
https://reviews.llvm.org/D87467
Files:
llvm/unittests/Support/ThreadPool.cpp
Index: llvm/unittests/Support/ThreadPool.cpp
===================================================================
--- llvm/unittests/Support/ThreadPool.cpp
+++ llvm/unittests/Support/ThreadPool.cpp
@@ -133,6 +133,13 @@
ASSERT_EQ(2, i.load());
}
+TEST_F(ThreadPoolTest, NonCopyableTask) {
+ CHECK_UNSUPPORTED();
+ ThreadPool Pool;
+ Pool.async([P = std::make_unique<int>()] {});
+ Pool.wait();
+};
+
TEST_F(ThreadPoolTest, GetFuture) {
CHECK_UNSUPPORTED();
ThreadPool Pool(hardware_concurrency(2));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87467.291020.patch
Type: text/x-patch
Size: 514 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200910/82c78b7a/attachment.bin>
More information about the llvm-commits
mailing list