Subj : Re: RCU+SMR To : comp.programming.threads From : Joe Seigh Date : Sat Jul 09 2005 10:52 am Chris Thomasson wrote: >>Way back, I came up with a scheme where you make the queue a lock-free >>LIFO stack using compare and swap. The single reader just grabbed the >>entire queue using compare and swap, reversed order making it FIFO >>and worked off of that util it was empty and then repeated the whole >>process by grabbing the shared LIFO stack again. > > > Yep. That works very well. I have used the simple scheme for a while as > well. I used an atomic exchange for the consumers: [...] > LIFO producers are inherently not affected by aba. On the other hand, LIFO > consumers are affected, but only if there is a "compare" type method being > used for synchronization. Using an atomic exchange to set the stack anchor > to zero can get around aba wrt LIFO lock-free stacks. Was that similar to > your initial solution? > > Yes. The null object has special properties. Remember null is an arbitrary definition. It doesn't have to be (void *)0 (except for C++). You should be able to make it an arbitrary designated address. In other words any designated placeholder object will work as well. -- Joe Seigh When you get lemons, you make lemonade. When you get hardware, you make software. .