mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 03:39:01 +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;
|
typedef typename Environment::EnvThread Thread;
|
||||||
|
|
||||||
struct PerThread {
|
struct PerThread {
|
||||||
PerThread() : pool(NULL), index(-1) {
|
PerThread() : pool(NULL), index(-1), rand(0) { }
|
||||||
rand = std::hash<std::thread::id>()(std::this_thread::get_id());
|
|
||||||
}
|
|
||||||
NonBlockingThreadPoolTempl* pool; // Parent pool, or null for normal threads.
|
NonBlockingThreadPoolTempl* pool; // Parent pool, or null for normal threads.
|
||||||
unsigned index; // Worker thread index in pool.
|
unsigned index; // Worker thread index in pool.
|
||||||
uint64_t rand; // Random generator state.
|
uint64_t rand; // Random generator state.
|
||||||
@ -122,6 +120,7 @@ class NonBlockingThreadPoolTempl : public Eigen::ThreadPoolInterface {
|
|||||||
PerThread* pt = GetPerThread();
|
PerThread* pt = GetPerThread();
|
||||||
pt->pool = this;
|
pt->pool = this;
|
||||||
pt->index = index;
|
pt->index = index;
|
||||||
|
pt->rand = std::hash<std::thread::id>()(std::this_thread::get_id());
|
||||||
Queue* q = queues_[index];
|
Queue* q = queues_[index];
|
||||||
EventCount::Waiter* waiter = &waiters_[index];
|
EventCount::Waiter* waiter = &waiters_[index];
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user