Subj : Re: Can C++ local static objects be made thread safe? To : comp.programming.threads From : David Hopwood Date : Fri Jan 21 2005 04:54 pm Gianni Mariani wrote: > SenderX wrote: [...] >> This must be compiled so the code sequence is executed in the "exact" >> order shown! All calls prefixed with 'ac_' are from my library. > > It seems as though > > ac_cpu_mb_consumer_depends() > and > ac_cpu_mb_producer(); > > are only applicable for non cache-coherent systems. > > Which architectures need memory barriers ? > > Obviously uniprocessors are not an issue. That's not obvious. Assuming preemptive multithreading, memory barriers are still needed on a uniprocessor to limit compiler reordering. (Another approach is to have the compiler cooperate with the threading system to ensure that preemption only occurs at safe points. I've only seen this done for higher-level, usually GC'd, languages.) -- David Hopwood .