-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Atomic bit operations on memory locations for low-level synchronization -- -- Atomic operations including CAS (compare-and-swap), lock and fetch -- & add suitable for low-level shared-memory synchronization. -- -- The implementation is using GCC's builtin atomic operations in C -- wrappers called through the FFI. -- -- Testing: The following commands can be used to compile and run -- the test suite: -- --
--   cabal unpack bits-atomic && cd bits-atomic-* # if not yet locally available
--   cabal configure -ftest
--   cabal build
--   cabal test
--   
-- -- Recent changes: -- -- @package bits-atomic @version 0.1.2 -- | Atomic bit operations, using GCC's built-in atomic operations in small -- C wrapper functions called through the FFI. See -- http://gcc.gnu.org/onlinedocs/gcc-4.5.0/gcc/Atomic-Builtins.html -- or the version corresponding to your compiler for more detail. module Data.Bits.Atomic -- | Atomic bit operations on a memory location. -- -- Instances: Word, Word8, Word16, Word32, -- Word64, Int, Int8, Int16, Int32, -- Int64. class (Bits x) => AtomicBits x fetchAndAdd :: (AtomicBits x) => Ptr x -> x -> IO x fetchAndSub :: (AtomicBits x) => Ptr x -> x -> IO x fetchAndOr :: (AtomicBits x) => Ptr x -> x -> IO x fetchAndAnd :: (AtomicBits x) => Ptr x -> x -> IO x fetchAndXor :: (AtomicBits x) => Ptr x -> x -> IO x fetchAndNand :: (AtomicBits x) => Ptr x -> x -> IO x addAndFetch :: (AtomicBits x) => Ptr x -> x -> IO x subAndFetch :: (AtomicBits x) => Ptr x -> x -> IO x orAndFetch :: (AtomicBits x) => Ptr x -> x -> IO x andAndFetch :: (AtomicBits x) => Ptr x -> x -> IO x xorAndFetch :: (AtomicBits x) => Ptr x -> x -> IO x nandAndFetch :: (AtomicBits x) => Ptr x -> x -> IO x compareAndSwapBool :: (AtomicBits x) => Ptr x -> x -> x -> IO Bool compareAndSwap :: (AtomicBits x) => Ptr x -> x -> x -> IO x lockTestAndSet :: (AtomicBits x) => Ptr x -> IO x lockRelease :: (AtomicBits x) => Ptr x -> IO () -- | A full memory barrier. memoryBarrier :: IO () instance AtomicBits Int64 instance AtomicBits Int32 instance AtomicBits Int16 instance AtomicBits Int8 instance AtomicBits Int instance AtomicBits Word instance AtomicBits Word64 instance AtomicBits Word32 instance AtomicBits Word16 instance AtomicBits Word8