Re: [Algorithms] lock-free stack with hazard list performance
Brought to you by:
vexxed72
|
From: Nicholas \Indy\ R. <ar...@gm...> - 2009-04-22 00:23:21
|
On Tue, Apr 21, 2009 at 4:28 PM, Stephan Rose <ke...@so...> wrote: > 2. Remove Node A and delete it. Major crash right there when thread 1 > now tries do it's CAS. Here is where I am confused, shouldn't the CAS be on the head pointer during a dequeue so, that if the CAS is successful (assuming that dequeue is the only way to get a reference to an item on the list, which is how lock-free queues should be anyways) you know that you are the only thread that has access to the node? > Both problems can be solved by ensuring that Node A is not recycled nor > deleted until all threads release their reference to it. All lock-free > implementations so far I've found have been in managed languages such as > C# or Java for that reason so far as the GC ensures exactly that. Again, not sure why multiple threads have reference to nodes still on the queue. Nicholas "Indy" Ray |