
FWIW there are other ways to avoid ABA than tagging pointers, and without DCAS on 32-bit, see e.g. this sample implementation of a lock-free stack:
http://www.chaoticmind.net/~hcb/projects/boost.atomic/stack.hpp
i ran some throughput benchmarks of your stack class vs mine (using the stack test without the data hash table) boost.lockfree stack, x86_64, pointer compression: 97019.782330 task-clock-msecs # 7.730 CPUs 108258 context-switches # 0.001 M/sec 14 CPU-migrations # 0.000 M/sec 820 page-faults # 0.000 M/sec 270234935420 cycles # 2785.359 M/sec 18556843363 instructions # 0.069 IPC 1002004340 cache-references # 10.328 M/sec 65412 cache-misses # 0.001 M/sec 1497109143 branches # 15.431 M/sec 159665283 branch-misses # 1.646 M/sec 12.550888223 seconds time elapsed helge's stack, x86_64: 97193.980901 task-clock-msecs # 6.829 CPUs 181307 context-switches # 0.002 M/sec 19 CPU-migrations # 0.000 M/sec 525 page-faults # 0.000 M/sec 270730718104 cycles # 2785.468 M/sec 21901021611 instructions # 0.081 IPC 816105899 cache-references # 8.397 M/sec 44053 cache-misses # 0.000 M/sec 4929368756 branches # 50.717 M/sec 234936307 branch-misses # 2.417 M/sec 14.231853706 seconds time elapsed i added your stack class to a new branch (topic/helge_stack) in my repository ... cheers, tim -- tim@klingt.org http://tim.klingt.org The price an artist pays for doing what he wants is that he has to do it. William S. Burroughs