Subj : Re: A question about atomic_ptr To : comp.programming.threads From : Joe Seigh Date : Thu Apr 14 2005 02:51 pm On Thu, 14 Apr 2005 18:54:12 +0200, Alexander Terekhov wrote: > > Alexander Terekhov wrote: >> >> Chris Thomasson wrote: >> > >> > > Does it try to access (via stwcx) reclaimed memory or not? >> > >> > http://groups.google.ca/groups?hl=en&lr=&selm=7I0Ea.854894%24OV.808546%40rwcrnsc54 >> >> Grr. CAS64 aside for a moment, Joe says (in that "refcount in object" > > It can go boom on LL/LR step too. > >> thread) "... decrement refcount to zero, and then destroy object. If >> it's after the load locked, the reservation is lost." Reservation is >> lost, that for sure. However, store-conditional can raise all sorts >> of "bad" exceptions (if the EA is "not good" by that time) even if >> reservation is lost. It's implementation-defined on Power, IIRC. > > Ok, Joe said that "It needs the virtual storage to always be valid so > the load locked won't segfault." > > Not sexy. > Well, we take what we can get. When you get lemons, you make lemonade. When you get hardware, you make software. BTW, it's the same restriction lock-free LIFO stack using DWCAS w/ version counts has. Not sexy but that doesn't stop anyone from using it. Original post of algorihm was here http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=1998Jun23.155614%40bose.com if you've forgotten. I did once. Algorithm works by setting the reserve before the verifying pointer load. If the pointer hasn't changed and the reserve hasn't been lost, then you have a valid reserve on a non-zero reference count. -- Joe Seigh .