Andrew Haley <aph@xxxxxxxxxx> writes: > I didn't mean to suggest that volatile would necessarily be > sufficient, but that it would be necessary. Surely the compiler needs > to know that the buffer is volatile, or what's to stop it re-ordering > accesses around the asm statements that are the memory barriers? I > know that in gcc we add a memory clobber to such asms, but that isn't > generally true. OK, if we have POSIX threads we also have POSIX > mutexes... Right: you have to use a mutex for correctness, and the mutex has to be magic. And once you use a magic mutex, using volatile doesn't make any difference. Ian