-- 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), fetch & add -- and variants suitable for low-level shared-memory synchronization. -- -- The implementation is using GCC's builtin atomic operations (available -- in GCC >= 4) in C wrappers called through the FFI. See these links -- for background: -- -- -- -- Portability: This package is primarily developed on a Linux -- system, but should work wherever GCC >= 4 is available. It has been -- confirmed as working on OSX. On Windows, it should work with Cygwin -- but currently fails for vanilla Haskell-Platform 2010.1.0.0 as it -- still packages GCC 3.x. An installer for updated versions of GCC is -- available at http://www.mingw.org/ and should make this package -- work in connection with Haskell-Platform. Feedback on compatibility -- would be appreciated. -- -- 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.3 -- | Atomic bit operations, using GCC's built-in atomic operations in small -- C wrapper functions called through the FFI. See -- http://gcc.gnu.org/wiki/Atomic and -- http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html 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