Lock-Free Data Structures. The Evolution of a Stack
kukuruku.co
kukuruku.co
[1] http://www.cs.bgu.ac.il/~hendlerd/papers/DECS.pdf [2] https://github.com/ben-manes/caffeine
Another solution is to simply return false and leave the decision of what to do, to the caller. Effectively:
bool try_push(value_type& value);
bool try_pop(value_type* result);
Most callers will simply: while(!try_push(&val)) bkoff();
However, in my specific case I was writing a toy thread pool. This meant that a failed pend could just result in an attempt to pend it to a different worker thread, instead of trying the same stack over again.