We inspected reference counting and hazard-pointer-based Treiber stacks earlier in this chapter and will follow this approach in this section as well. Fortunately, crossbeam also ships with a Treiber stack implementation, in the crossbeam-rs/crossbeam project, which we'll examine at SHA 89bd6857cd701bff54f7a8bf47ccaa38d5022bfb, which is the source for crossbeam::sync::TreiberStack is in src/sync/treiber_stack.rs. The preamble is almost immediately interesting:
use std::sync::atomic::Ordering::{Acquire, Relaxed, Release}; use std::ptr; use epoch::{self, Atomic, Owned};
What, for instance, are epoch::Atomic and epoch::Owned? Well, we'll explore these here. Unlike the section on hazard pointers, which explored the ...