From c696dbcaa6e17cdfa6c9ff37dadf89cf4b707504 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 21 Sep 2018 23:02:33 +0200 Subject: Fiw shadowing of last and all --- unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 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 6fc6688d3..1612c004b 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h @@ -213,17 +213,17 @@ struct ThreadPoolDevice { // block_count leaves that do actual computations. Barrier barrier(static_cast(block_count)); std::function handleRange; - handleRange = [=, &handleRange, &barrier, &f](Index first, Index last) { - if (last - first <= block_size) { + handleRange = [=, &handleRange, &barrier, &f](Index firstIdx, Index lastIdx) { + if (lastIdx - firstIdx <= block_size) { // Single block or less, execute directly. - f(first, last); + f(firstIdx, lastIdx); barrier.Notify(); return; } // Split into halves and submit to the pool. - Index mid = first + divup((last - first) / 2, block_size) * block_size; - pool_->Schedule([=, &handleRange]() { handleRange(mid, last); }); - handleRange(first, mid); + Index mid = firstIdx + divup((lastIdx - firstIdx) / 2, block_size) * block_size; + pool_->Schedule([=, &handleRange]() { handleRange(mid, lastIdx); }); + handleRange(firstIdx, mid); }; handleRange(0, n); barrier.Wait(); -- cgit v1.2.3