-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Lock free Treiber stack -- @package Treiber @version 0.0.4 -- | An implementation of Treiber stacks, a lock free stack. Works with any -- monad that has atomically modificable references. module Data.NonBlocking.LockFree.Treiber -- | A lock-free concurrent Treiber stack usable in any Monad, m, -- that is paired with a reference type, r, by an instance of -- MonadAtomicRef. Can use Specializations TreiberStackIO -- and TreiberStackSTM. data TreiberStack r a -- | TreiberStack inside the IO Monad. type TreiberStackIO a = TreiberStack IORef a -- | TreiberStack inside the STM Monad. type TreiberStackSTM a = TreiberStack TVar a -- | Creates a new empty instance of the TreiberStack. Internally -- implemented with a reference of type r, which is why they must be -- atomically modifiable. Initially empty. newTreiberStack :: MonadAtomicRef r m => m (TreiberStack r a) -- | Pushes an element on to a TreiberStack in a lock-free manner. pushTreiberStack :: MonadAtomicRef r m => TreiberStack r a -> a -> m () -- | Pops an element of a TreiberStack in a lock-free manner. -- Returns Nothing if the stack is empty. popTreiberStack :: MonadAtomicRef r m => TreiberStack r a -> m (Maybe a) instance Eq (TreiberElem r a)