Subj : Re: posix and lock-free algorithms To : comp.programming.threads From : David Schwartz Date : Mon Aug 01 2005 03:46 pm "David Hopwood" wrote in message news:1CwHe.6711$GO1.5036@fe3.news.blueyonder.co.uk... > David Schwartz wrote: >> Mutexes only protect memory access that occur while the mutex is held. > Chapter and verse, please. > (Yes, the suggested memory_barrier() does not work. I'm just nitpicking > about > the reason why it doesn't work, and whether what POSIX actually says > allows > you to infer the statement above.) My copy of the standard is on a high shelf and my ladder is outside, but it's the section that says that what happens if memory is read by one thread after being modified by another is undefined unless you follow one of the patterns specifically stated. The offered technique is not one of the ones stated. The only one involving mutexes says that you must hold the same mutex under which the changing thread held after the change was made. DS .