diff options
author | Eugene Zhulenev <ezhulenev@google.com> | 2018-10-16 16:48:32 -0700 |
---|---|---|
committer | Eugene Zhulenev <ezhulenev@google.com> | 2018-10-16 16:48:32 -0700 |
commit | 9e96e91936bdcb5fac72109b165c2880ff87272a (patch) | |
tree | f94f67d28aee22f77dfdb4a6004bc33d981bedbc /unsupported/Eigen/CXX11/src/Tensor | |
parent | 217d839816c96dd53d3572bc18489109c85d5266 (diff) |
Move from rvalue arguments in ThreadPool enqueue* methods
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h | 22 |
1 files changed, 13 insertions, 9 deletions
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 <class Function, class... Args> - 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<Function, Args...>::run, n, f, args...)); + pool_->Schedule( + std::bind(&FunctionWrapperWithNotification<Function, Args...>::run, n, + std::move(f), args...)); return n; } template <class Function, class... Args> - 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<Function, Args...>::run, b, f, args...)); + pool_->Schedule( + std::bind(&FunctionWrapperWithBarrier<Function, Args...>::run, b, + std::move(f), args...)); } template <class Function, class... Args> - 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)); } } |