Subj : Re: posix and lock-free algorithms To : comp.programming.threads From : David Hopwood Date : Mon Aug 01 2005 11:32 pm David Schwartz wrote: > "David Hopwood" wrote: >>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, The standard is online, e.g. . > 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. That must be XBD 4.10, but I don't see anything that states particular programming patterns in that section. The requirement is only that "no thread of control can read or modify a memory location while another thread of control may be modifying it." The following bit about functions that "synchronize memory" can't be talking about the normal pattern of use of mutexes, because it doesn't distinguish, say, pthread_mutex_lock from pthread_mutex_unlock. -- David Hopwood .