Micha Nelissen pisze:
DarekM wrote:
Hi
This is my proposition of algorithm and its implementing multithreaded
FIFO queue without lock.
Hmm 'Push' and 'Pop' sound like a stack, but the implementation seems to
implement a FIFO indeed, with a head and tail.
It should be enqueue and dequeue. I was left because first I try
implement stack.
You're sure about the situation where two threads are accessing head and
tail at the same time, and there is only one item in your FIFO ?
Of course (if CAS (interlockedCompareExchange) has proper
implementation , that, I think, should be avoided
Queue is empty when tail=head,
when is not equal only one thread can receive object form queue, second
make again iteration
The same with ABA problem.
Darek
_______________________________________________
fpc-devel maillist - [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel