-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Lock free Spin Counter
--
@package SpinCounter
@version 0.0.1
-- | An implementation of a lock-free spin counter. Works with any monad
-- that has atomically modificable references.
module Data.NonBlocking.LockFree.SpinCounter
-- | A lock-free concurrent Spin counter usable in any monad, m, that is
-- paired with a reference type, r, by an instance of
-- MonadAtomicRef. Can use Specializations SpinCounterIO
-- and SpinCounterSTM
data SpinCounter r
-- | SpinCounter inside the IO Monad.
type SpinCounterIO = SpinCounter IORef
-- | SpinCounter inside the STM Monad.
type SpinCounterSTM = SpinCounter TVar
-- | Creates a new instance of the SpinCounter data type initialized
-- to value of the input to the function, an instance of the class
-- Integral.
newSpinCounter :: (MonadAtomicRef r m, Integral a) => a -> m (SpinCounter r)
-- | Increments an instance of the SpinCounter data type by one in a
-- lock-free manner.
incSpinCounter :: MonadAtomicRef r m => SpinCounter r -> m ()
-- | Reads the value of an instance of the SpinCounter data type in
-- a lock-free manner.
readSpinCounter :: (MonadAtomicRef r m, Num a) => SpinCounter r -> m a