[llvm] 54fcea8 - Revert "[Support] Use unique_function rather than std::function for ThreadPool TaskTy."
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 11:53:17 PDT 2020
Author: Lang Hames
Date: 2020-09-10T11:53:09-07:00
New Revision: 54fcea86b1658f5fc70f4f1e7a763f87742d79bc
URL: https://github.com/llvm/llvm-project/commit/54fcea86b1658f5fc70f4f1e7a763f87742d79bc
DIFF: https://github.com/llvm/llvm-project/commit/54fcea86b1658f5fc70f4f1e7a763f87742d79bc.diff
LOG: Revert "[Support] Use unique_function rather than std::function for ThreadPool TaskTy."
This reverts commit d9c8b0256cfc673c2413b13993c9440be598818f.
Some MSVC std::packaged_task implementations are not compatible with move-only types.
This caused failures on some of the Windows builders (e.g.
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/69412).
Reverting until I can come up with a workaround.
Added:
Modified:
llvm/include/llvm/Support/ThreadPool.h
llvm/unittests/Support/ThreadPool.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/ThreadPool.h b/llvm/include/llvm/Support/ThreadPool.h
index 3d24fb099739..528fb32525eb 100644
--- a/llvm/include/llvm/Support/ThreadPool.h
+++ b/llvm/include/llvm/Support/ThreadPool.h
@@ -13,7 +13,6 @@
#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"
@@ -37,7 +36,7 @@ namespace llvm {
/// for some work to become available.
class ThreadPool {
public:
- using TaskTy = unique_function<void()>;
+ using TaskTy = std::function<void()>;
using PackagedTaskTy = std::packaged_task<void()>;
/// Construct a pool using the hardware strategy \p S for mapping hardware
diff --git a/llvm/unittests/Support/ThreadPool.cpp b/llvm/unittests/Support/ThreadPool.cpp
index b3747376689a..43882d0f3cee 100644
--- a/llvm/unittests/Support/ThreadPool.cpp
+++ b/llvm/unittests/Support/ThreadPool.cpp
@@ -133,13 +133,6 @@ TEST_F(ThreadPoolTest, Async) {
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));
More information about the llvm-commits
mailing list