diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-06-22 16:03:11 -0700 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-06-22 16:03:11 -0700 |
commit | f8fcd6b32d6b1a3613330e553bb3bc52a0007192 (patch) | |
tree | 51e67cda2815b33a479135ebb0c8822d2d8e845c /unsupported/Eigen/CXX11/src/ThreadPool | |
parent | c58df317473277b297dd018a2dc3d8fe85b00c92 (diff) |
Turned the constructor of the PerThread struct into what is effectively a constant expression to make the code compatible with a wider range of compilers
Diffstat (limited to 'unsupported/Eigen/CXX11/src/ThreadPool')
-rw-r--r-- | unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h b/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h index 30b292352..8d4973ded 100644 --- a/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h +++ b/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h @@ -99,9 +99,7 @@ class NonBlockingThreadPoolTempl : public Eigen::ThreadPoolInterface { typedef typename Environment::EnvThread Thread; struct PerThread { - PerThread() : pool(NULL), index(-1) { - rand = std::hash<std::thread::id>()(std::this_thread::get_id()); - } + PerThread() : pool(NULL), index(-1), rand(0) { } NonBlockingThreadPoolTempl* pool; // Parent pool, or null for normal threads. unsigned index; // Worker thread index in pool. uint64_t rand; // Random generator state. @@ -122,6 +120,7 @@ class NonBlockingThreadPoolTempl : public Eigen::ThreadPoolInterface { PerThread* pt = GetPerThread(); pt->pool = this; pt->index = index; + pt->rand = std::hash<std::thread::id>()(std::this_thread::get_id()); Queue* q = queues_[index]; EventCount::Waiter* waiter = &waiters_[index]; for (;;) { |