
Helge Bahmann wrote:
I'm not sure this works, it is just an attempt based on a bold suspicion of what the actual problem is :) But it would sure be interesting if you could try that out or something similar
__restrict didn't solve the problem on MS Visual C++ 2008 :-( static inline atomic64_t load64( atomic64_t volatile const * pMem ) { // Atomically loads 64bit value by SSE intrinsics __m128i v = _mm_loadl_epi64( (__m128i const * __restrict) pMem ) ; return v.m128i_i64[0] ; } - infinite loop in spinlock on atomic64_t. However, Peter Dimov's advice corrected the error - volatile! Yes! This code static inline atomic64_t load64( atomic64_t volatile const * pMem ) { // Atomically loads 64bit value by SSE intrinsics __m128i volatile v = _mm_loadl_epi64( (__m128i const *) pMem ) ; return v.m128i_i64[0] ; } works well. Thanks, Peter! Regards, Max