mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-11 11:19:02 +08:00
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
This commit is contained in:
parent
c58df31747
commit
f8fcd6b32d
@ -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 (;;) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user