Subj : Re: posix and lock-free algorithms To : comp.programming.threads From : David Schwartz Date : Sat Aug 13 2005 02:42 am "David Hopwood" wrote in message news:%ibLe.1360$P.386@fe3.news.blueyonder.co.uk... > David Schwartz wrote: >> For example, a common pattern is to create an object, initialize it, >> acquire a lock, and add a pointer to that object so other threads can see >> it, then release the lock. > > That's trickier than you might think. In particular, if the other threads > can read the location to which the pointer is written without holding the > lock, the behaviour is undefined (by POSIX). They can't. This pattern is never used that way. The only way other threads can find the object is through the pointer and the pointer is always written to and read from a properly synchronized data structure of some sort (hash table, linked list, whatever). DS .