[fpc-devel] LockFree Queue algorithm
fpc at mfriebe.de
Sun Jan 27 15:11:36 CET 2008
What about a long running (eg daemon) application?
If temp/tail hits the upper boundary of Integer?
(If I understand it correctly)
I don't know if interlockedIncrement gives a boundary error, but if not,
it still fails.
- With currently integer, it gets a negative value, once crossing
0x7fffffff, and SetObject will attempt to read/write out-of-bounds memory.
- Assuming temp/tail being unsigned: it will go from 0xffffffff to 0.
"0xffffffff mod fsize" may return a value greater 0, "0x00 mod fsize"
will be zero. You make an unexpected jump within the list.
> This is my proposition of algorithm and its implementing multithreaded
> FIFO queue without lock.
> First use array of pointers to handle messages.
> I've use it in my program, it works.
> I think it may by useful.
> site: http://www.emadar.com/fpc/lockfree.htm
> source: http://www.emadar.com/fpc/flqueue.pas
> There is also generic implementation of the same algorithm. Its my
> first generic approach.
> Any help appreciated.
> it;s not so much text, but source is very short, its explain much
> fpc-devel maillist - fpc-devel at lists.freepascal.org
More information about the fpc-devel