3 ms·
It may be lock free, but it's not very wait free. Maybe I'm just tired, but OS X and Windows already have atomic lifo's that are much better: http://www.openso
by CoolGuySteve 14y ago
It may be lock free, but it's not very wait free.
Maybe I'm just tired, but OS X and Windows already have atomic lifo's that are much better:
http://www.opensource.apple.com/source/Libc/Libc-763.13/i386/sys/OSAtomic.s http://www.opensource.apple.com/source/Libc/Libc-763.13/i386...
(scroll to bottom, see declaration in /usr/include/libkern/OSAtomic.h)
http://msdn.microsoft.com/en-us/library/windows/desktop/ms684121(v=vs.85).aspx http://msdn.microsoft.com/en-us/library/windows/desktop/ms68...
For linux, there's llist.h in the kernel, but I don't know of a userland version and I haven't used it.
- matthavener 14y agoThe article demos a list, where threads are contending to append to the top of it. Unlike a list, there is not much contention on a FIFO unless its typically empty..
- CoolGuySteve 14y agoYou are correct, I meant lifo but wrote fifo. OSEnqueueAtomic/OSDequeueAtomic and InterlockedSList, by virtue of only being able to push and pop the head, are effectively LIFOs.
- zippie 14y agoThere is, of sorts (rbtree), http://github.com/johnj/llds http://github.com/johnj/llds