Re: [eigen] Help on solving a race condition

[ Thread Index | Date Index | More Archives ]

static std::ptrdiff_t m_l1CacheSize = 0;
static std::ptrdiff_t m_l2CacheSize = 0;
static bool initialized = false;
There is no guarantee that the "initialized = true" gets seen by another
thread after the update to "m_l1CacheSize" or "m_l2CacheSize" gets seen
by that thread. The order of the stores can be differently perceived by

There is also quite a good explanation of these things at Pre C++11 behavior seems to be memory_order_relaxed but without atomic variables so pretty much anything goes. A concrete example:

t1 sees
initialize == false
and does
m_l1CacheSize = manage_caching...
initialized = true;

"after" that t2 does
m_l1CacheSize = 0;
but already sees
initialized == true;

resulting (possibly) in obviously wrong sizes of 0.


Mail converted by MHonArc 2.6.19+