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::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::this_thread::get_id()); Queue* q = queues_[index]; EventCount::Waiter* waiter = &waiters_[index]; for (;;) {