Subj : Re: Memory Barriers, Compiler Optimizations, etc. To : comp.programming.threads From : Joseph Seigh Date : Mon Feb 07 2005 08:22 am On Mon, 07 Feb 2005 13:57:23 +0100, Alexander Terekhov wrote: > > Joseph Seigh wrote: >> >> On Mon, 07 Feb 2005 12:13:10 +0100, Alexander Terekhov wrote: >> >> > >> > "Neill Clift [MSFT]" wrote: >> > [...] >> >> >> I believe we do have a full barrier >> > >> > I believe that barrier makes little sense in the case of >> > comparison failure. >> > >> What are you saying? That failed compare and swaps shouldn't >> have memory barrier semantics? > > Yes (actually "unspecified"). Just like with failed > pthread_mutex_trylock(). See XBD 4.10. "Unless explicitly stated > otherwise, if one of the above functions returns an error, it is > unspecified whether the invocation causes memory to be > synchronized." > I'm aware of having failed CAS logic in singleton, DCL, etc... logic. I'm not sure where trylock fits in. -- Joe Seigh .