-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A typeclass for mutable references that have an atomic modify operation. -- -- A typeclass for mutable references that have an atomic modify -- operation. Generalizes atomic modify operations in IO and STM contexts -- for IORef, MVar, TVar, and TMVar. @package atomic-modify @version 0.1.0.3 -- | Provides AtomicModify, a typeclass for mutable references that -- have an atomic modify operations. This generalizes atomic modify -- operations in IO and STM contexts for IORef, -- MVar, TVar, and TMVar. -- --
module Control.Concurrent.AtomicModify -- | A typeclass for mutable references that have an atomic modify -- operation. -- -- Type variables: -- -- -- -- As the name "atomic" implies, these functions are useful for using -- mutable references in a safe way to prevent race conditions in a -- multithreaded program. class AtomicModify ref m -- | Atomically modify the contents of a ref (type a) and -- produce a value (type b). This is strict; it forces the value -- stored in the ref as well as the value returned. atomicModifyStrict :: AtomicModify ref m => ref a -> (a -> (a, b)) -> m b -- | Atomically modify the contents of a ref (type a) and -- produce a value (type b). This is lazy, which means if the -- program calls atomicModifyLazy many times, but seldomly uses -- the value, thunks will pile up in memory resulting in a space leak. atomicModifyLazy :: AtomicModify ref m => ref a -> (a -> (a, b)) -> m b -- | Atomically modify the contents of a ref. This is strict; it -- forces the value stored in the ref as well as the value -- returned. atomicModifyStrict_ :: AtomicModify v m => v a -> (a -> a) -> m () -- | Atomically modify the contents of a ref (type a) and -- produce a value (type b). This is lazy, which means if the -- program calls atomicModifyLazy_ many times, but seldomly uses -- the value, thunks will pile up in memory resulting in a space leak. atomicModifyLazy_ :: AtomicModify v m => v a -> (a -> a) -> m () instance Control.Concurrent.AtomicModify.AtomicModify GHC.IORef.IORef GHC.Types.IO instance Control.Concurrent.AtomicModify.AtomicModify GHC.MVar.MVar GHC.Types.IO instance Control.Concurrent.AtomicModify.AtomicModify GHC.Conc.Sync.TVar GHC.Conc.Sync.STM instance Control.Concurrent.AtomicModify.AtomicModify Control.Concurrent.STM.TMVar.TMVar GHC.Conc.Sync.STM instance Control.Concurrent.AtomicModify.AtomicModify GHC.Conc.Sync.TVar GHC.Types.IO instance Control.Concurrent.AtomicModify.AtomicModify Control.Concurrent.STM.TMVar.TMVar GHC.Types.IO