-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Michael-Scott queue.
--
@package MSQueue
@version 0.0.1
-- | An Implementation of a Michael-Scott Lock-Free queues.
module Data.NonBlocking.LockFree.MSQueue
-- | Implementation of Michael-Scott Lock-Free queues. Specification and
-- pseudo-code can be found at
-- http://www.research.ibm.com/people/m/michael/podc-1996.pdf.
-- Works with any combination of Monad and reference satsfying the
-- MonadAtomicRef class.
data MSQueue r a
-- | MSQueue inside the IO Monad.
type MSQueueIO a = MSQueue IORef a
-- | MSQueue inside the STM Monad.
type MSQueueSTM a = MSQueue TVar a
-- | Creates a new instance of MSQueue. Internally implemented with
-- a reference of type r, which is why they must be atomically
-- modifiable. Initially empty.
newMSQueue :: MonadAtomicRef r m => m (MSQueue r a)
-- | Dequeues an element from a MSQueue in a lock-free manner.
-- Returns Nothing if the queue is empty, otherwise return the element
-- wrapped in a Just.
dequeueMSQueue :: MonadAtomicRef r m => MSQueue r a -> m (Maybe a)
-- | Enqueues an element in a MSQueue in a lock-free manner.
enqueueMSQueue :: MonadAtomicRef r m => MSQueue r a -> a -> m ()
instance Eq a => Eq (MSQueueElem r a)