aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h
diff options
context:
space:
mode:
authorGravatar Rasmus Munk Larsen <rmlarsen@google.com>2016-06-23 16:40:07 -0700
committerGravatar Rasmus Munk Larsen <rmlarsen@google.com>2016-06-23 16:40:07 -0700
commita9c1e4d7b7ce7c9dc5310cee1ed13fdef08e506e (patch)
tree0da9ce7e94a29f6fc1071b4b0286ad089f803dc5 /unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h
parentd39df320d29ecc678e019962dfb2bdf64b061197 (diff)
Return -1 from CurrentThreadId when called by thread outside the pool.
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h')
-rw-r--r--unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h
index 0af91fe64..34270730b 100644
--- a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h
+++ b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h
@@ -172,6 +172,8 @@ struct ThreadPoolDevice {
pool_->Schedule(func);
}
+ // Returns a logical thread index between 0 and pool_->NumThreads() - 1 if
+ // called from one of the threads in pool_. Returns -1 otherwise.
EIGEN_STRONG_INLINE int currentThreadId() const {
return pool_->CurrentThreadId();
}