Subject: Re: [boost] [lock-free] CDS -yet another lock-free library
From: Khiszinsky, Maxim (Maxim.Khiszinsky_at_[hidden])
Date: 2010-03-31 01:24:00
Giovanni Piero Deretta wrote
> Shouldn't volatile go in the cast and not in v? It is fine if v is
> stored in a register, but you want the read to pMem not to be cached.
> What you are doing with the cast right now is casting away
> volatile-ness in addition of changing the type of the pointed object.
> The fact that it is now working is probably just due to the fact that
> the compiler is confused: the compiler is still free to hoist the
> loads from pmem, as long as all stores and loads to v (which is in the
> stack) are done.
Yes, I agree
However, the parameter of _mm_loadl_epi64 is declared as non-volatile and casting
_mm_loadl_epi64( (__m128i volatile const *) pMem )
The solution from CDS library is a workaround for MS Visual C++ compiler. I cannot invent something better now.
Second solution: use 64bit CAS to load/store 64bit values on x86. It seems too heavy for just loading/storing it isn't?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk