From 9e96e91936bdcb5fac72109b165c2880ff87272a Mon Sep 17 00:00:00 2001 From: Eugene Zhulenev Date: Tue, 16 Oct 2018 16:48:32 -0700 Subject: Move from rvalue arguments in ThreadPool enqueue* methods --- .../CXX11/src/Tensor/TensorDeviceThreadPool.h | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h index 47025a510..413b94579 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h @@ -109,26 +109,30 @@ struct ThreadPoolDevice { } template - EIGEN_STRONG_INLINE Notification* enqueue(Function&& f, Args&&... args) const { + EIGEN_STRONG_INLINE Notification* enqueue(Function&& f, + Args&&... args) const { Notification* n = new Notification(); - pool_->Schedule(std::bind(&FunctionWrapperWithNotification::run, n, f, args...)); + pool_->Schedule( + std::bind(&FunctionWrapperWithNotification::run, n, + std::move(f), args...)); return n; } template - EIGEN_STRONG_INLINE void enqueue_with_barrier(Barrier* b, - Function&& f, + EIGEN_STRONG_INLINE void enqueue_with_barrier(Barrier* b, Function&& f, Args&&... args) const { - pool_->Schedule(std::bind( - &FunctionWrapperWithBarrier::run, b, f, args...)); + pool_->Schedule( + std::bind(&FunctionWrapperWithBarrier::run, b, + std::move(f), args...)); } template - EIGEN_STRONG_INLINE void enqueueNoNotification(Function&& f, Args&&... args) const { + EIGEN_STRONG_INLINE void enqueueNoNotification(Function&& f, + Args&&... args) const { if (sizeof...(args) > 0) { - pool_->Schedule(std::bind(f, args...)); + pool_->Schedule(std::bind(std::move(f), args...)); } else { - pool_->Schedule(f); + pool_->Schedule(std::move(f)); } } -- cgit v1.2.3