{-# LANGUAGE NoImplicitPrelude #-} -- | Atomic operations. -- -- IMPORTANT: If you are not an expert in concurrent lockless programming, you should not be using any functions in this file. You should be protecting your data structures with full mutexes instead. -- -- /__Seriously, here be dragons!__/ -- -- You can find out a little more about lockless programming and the subtle issues that can arise here: [https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/dxtecharts\/lockless-programming](https://learn.microsoft.com/en-us/windows/win32/dxtecharts/lockless-programming) -- -- There\'s also lots of good information here: -- -- * [https:\/\/www.1024cores.net\/home\/lock-free-algorithms](https://www.1024cores.net/home/lock-free-algorithms) -- -- * [https:\/\/preshing.com\/](https://preshing.com/) -- -- These operations may or may not actually be implemented using processor specific atomic operations. When possible they are implemented as true processor specific atomic operations. When that is not possible the are implemented using locks that /do/ use the available atomic operations. -- -- All of the atomic operations that modify memory are full memory barriers. An atomic spinlock. -- -- The atomic locks are efficient spinlocks using CPU instructions, but are vulnerable to starvation and can spin forever if a thread holding a lock has been terminated. For this reason you should minimize the code executed inside an atomic lock and never do expensive things like API or system calls while holding them. -- -- They are also vulnerable to starvation if the thread holding the lock is lower priority than other threads and doesn\'t get scheduled. In general you should use mutexes instead, since they have better performance and contention behavior. -- -- The atomic locks are not safe to lock recursively. -- -- Porting Note: The spin lock functions and type are required and can not be emulated because they are used in the atomic emulation code. -- -- == FFI conventions -- -- Unsuffixed aliases are __unsafe__ foreign imports; aliases suffixed @Safe@ are safe. Functions whose callbacks fire during the call export only the Safe alias (the genuine unsafe import stays reachable under @SDL3.Sys.Bindgen.Atomic.Unsafe@); functions curated unsafe-only export only the unsuffixed one. Each alias\'s documentation records its flavor and rationale. -- -- The C shims are functions this package defines in C over what the FFI cannot call directly (variadic functions, function-like macros), each named after what it wraps; the same flavor rules apply. Their raw imports live under "SDL3.Sys.Bindgen.AtomicShims". -- -- Full conventions: "SDL3.Sys". module SDL3.Sys.Atomic ( module SDL3.Sys.Bindgen.Atomic, -- * Function aliases SDL3.Sys.Atomic.tryLockSpinlock, SDL3.Sys.Atomic.tryLockSpinlockSafe, SDL3.Sys.Atomic.lockSpinlock, SDL3.Sys.Atomic.lockSpinlockSafe, SDL3.Sys.Atomic.unlockSpinlock, SDL3.Sys.Atomic.unlockSpinlockSafe, SDL3.Sys.Atomic.memoryBarrierReleaseFunction, SDL3.Sys.Atomic.memoryBarrierReleaseFunctionSafe, SDL3.Sys.Atomic.memoryBarrierAcquireFunction, SDL3.Sys.Atomic.memoryBarrierAcquireFunctionSafe, SDL3.Sys.Atomic.compareAndSwapAtomicInt, SDL3.Sys.Atomic.compareAndSwapAtomicIntSafe, SDL3.Sys.Atomic.setAtomicInt, SDL3.Sys.Atomic.setAtomicIntSafe, SDL3.Sys.Atomic.getAtomicInt, SDL3.Sys.Atomic.getAtomicIntSafe, SDL3.Sys.Atomic.addAtomicInt, SDL3.Sys.Atomic.addAtomicIntSafe, SDL3.Sys.Atomic.compareAndSwapAtomicU32, SDL3.Sys.Atomic.compareAndSwapAtomicU32Safe, SDL3.Sys.Atomic.setAtomicU32, SDL3.Sys.Atomic.setAtomicU32Safe, SDL3.Sys.Atomic.getAtomicU32, SDL3.Sys.Atomic.getAtomicU32Safe, SDL3.Sys.Atomic.addAtomicU32, SDL3.Sys.Atomic.addAtomicU32Safe, SDL3.Sys.Atomic.compareAndSwapAtomicPointer, SDL3.Sys.Atomic.compareAndSwapAtomicPointerSafe, SDL3.Sys.Atomic.setAtomicPointer, SDL3.Sys.Atomic.setAtomicPointerSafe, SDL3.Sys.Atomic.getAtomicPointer, SDL3.Sys.Atomic.getAtomicPointerSafe, -- * C shims SDL3.Sys.Atomic.atomicIncRef, SDL3.Sys.Atomic.atomicIncRefSafe, SDL3.Sys.Atomic.atomicDecRef, SDL3.Sys.Atomic.atomicDecRefSafe, ) where import Data.Coerce qualified as Coerce import Prelude (Bool, IO, fmap) import HsBindgen.Runtime.CBool qualified as CBool import HsBindgen.Runtime.LibC qualified import HsBindgen.Runtime.Support qualified as BG import SDL3.Sys.Bindgen.Atomic import SDL3.Sys.Bindgen.Atomic qualified import SDL3.Sys.Bindgen.Atomic.Safe qualified as Safe import SDL3.Sys.Bindgen.Atomic.Unsafe qualified as Unsafe import SDL3.Sys.Bindgen.AtomicShims.Safe qualified as Safe import SDL3.Sys.Bindgen.AtomicShims.Unsafe qualified as Unsafe import SDL3.Sys.Bindgen.Stdinc qualified -- | Try to lock a spin lock by setting it to a non-zero value. -- -- /__Please note that spinlocks are dangerous if you don\'t know what you\'re doing. Please be careful using any sort of spinlock!__/ -- -- [Returns]: true if the lock succeeded, false if the lock is already held. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'lockSpinlock', 'unlockSpinlock' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Unsafe__ foreign import of @SDL_TryLockSpinlock@. -- The safe flavor is 'tryLockSpinlockSafe' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @SDL_TryLockSpinlock@, defined at @SDL3\/SDL_atomic.h 100:34@ tryLockSpinlock :: BG.Ptr SDL_SpinLock -- ^ -- -- [@lock@]: a pointer to a lock variable. -> IO Bool tryLockSpinlock :: Ptr SDL_SpinLock -> IO Bool tryLockSpinlock = \Ptr SDL_SpinLock x00 -> (CBool -> Bool) -> IO CBool -> IO Bool forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap CBool -> Bool forall b. (Eq b, Num b) => b -> Bool CBool.toBool (Ptr SDL_SpinLock -> IO CBool Unsafe.sDL_TryLockSpinlock Ptr SDL_SpinLock x00) -- | Try to lock a spin lock by setting it to a non-zero value. -- -- /__Please note that spinlocks are dangerous if you don\'t know what you\'re doing. Please be careful using any sort of spinlock!__/ -- -- [Returns]: true if the lock succeeded, false if the lock is already held. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'lockSpinlock', 'unlockSpinlock' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Safe__ foreign import of @SDL_TryLockSpinlock@. -- The unsafe flavor is 'tryLockSpinlock' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @SDL_TryLockSpinlock@, defined at @SDL3\/SDL_atomic.h 100:34@ tryLockSpinlockSafe :: BG.Ptr SDL_SpinLock -- ^ -- -- [@lock@]: a pointer to a lock variable. -> IO Bool tryLockSpinlockSafe :: Ptr SDL_SpinLock -> IO Bool tryLockSpinlockSafe = \Ptr SDL_SpinLock x00 -> (CBool -> Bool) -> IO CBool -> IO Bool forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap CBool -> Bool forall b. (Eq b, Num b) => b -> Bool CBool.toBool (Ptr SDL_SpinLock -> IO CBool Safe.sDL_TryLockSpinlock Ptr SDL_SpinLock x00) -- | Lock a spin lock by setting it to a non-zero value. -- -- /__Please note that spinlocks are dangerous if you don\'t know what you\'re doing. Please be careful using any sort of spinlock!__/ -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'tryLockSpinlock', 'unlockSpinlock' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Unsafe__ foreign import of @SDL_LockSpinlock@. -- The safe flavor is 'lockSpinlockSafe' -- . -- -- [C declaration]: @SDL_LockSpinlock@, defined at @SDL3\/SDL_atomic.h 117:34@ lockSpinlock :: BG.Ptr SDL_SpinLock -- ^ -- -- [@lock@]: a pointer to a lock variable. -> IO () lockSpinlock :: Ptr SDL_SpinLock -> IO () lockSpinlock = Ptr SDL_SpinLock -> IO () Unsafe.sDL_LockSpinlock -- | Lock a spin lock by setting it to a non-zero value. -- -- /__Please note that spinlocks are dangerous if you don\'t know what you\'re doing. Please be careful using any sort of spinlock!__/ -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'tryLockSpinlock', 'unlockSpinlock' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Safe__ foreign import of @SDL_LockSpinlock@. -- The unsafe flavor is 'lockSpinlock' -- . -- -- [C declaration]: @SDL_LockSpinlock@, defined at @SDL3\/SDL_atomic.h 117:34@ lockSpinlockSafe :: BG.Ptr SDL_SpinLock -- ^ -- -- [@lock@]: a pointer to a lock variable. -> IO () lockSpinlockSafe :: Ptr SDL_SpinLock -> IO () lockSpinlockSafe = Ptr SDL_SpinLock -> IO () Safe.sDL_LockSpinlock -- | Unlock a spin lock by setting it to 0. -- -- Always returns immediately. -- -- /__Please note that spinlocks are dangerous if you don\'t know what you\'re doing. Please be careful using any sort of spinlock!__/ -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'lockSpinlock', 'tryLockSpinlock' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Unsafe__ foreign import of @SDL_UnlockSpinlock@. -- The safe flavor is 'unlockSpinlockSafe' -- . -- -- [C declaration]: @SDL_UnlockSpinlock@, defined at @SDL3\/SDL_atomic.h 136:34@ unlockSpinlock :: BG.Ptr SDL_SpinLock -- ^ -- -- [@lock@]: a pointer to a lock variable. -> IO () unlockSpinlock :: Ptr SDL_SpinLock -> IO () unlockSpinlock = Ptr SDL_SpinLock -> IO () Unsafe.sDL_UnlockSpinlock -- | Unlock a spin lock by setting it to 0. -- -- Always returns immediately. -- -- /__Please note that spinlocks are dangerous if you don\'t know what you\'re doing. Please be careful using any sort of spinlock!__/ -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'lockSpinlock', 'tryLockSpinlock' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Safe__ foreign import of @SDL_UnlockSpinlock@. -- The unsafe flavor is 'unlockSpinlock' -- . -- -- [C declaration]: @SDL_UnlockSpinlock@, defined at @SDL3\/SDL_atomic.h 136:34@ unlockSpinlockSafe :: BG.Ptr SDL_SpinLock -- ^ -- -- [@lock@]: a pointer to a lock variable. -> IO () unlockSpinlockSafe :: Ptr SDL_SpinLock -> IO () unlockSpinlockSafe = Ptr SDL_SpinLock -> IO () Safe.sDL_UnlockSpinlock -- | Insert a memory release barrier (function version). -- -- Please refer to SDL_MemoryBarrierRelease for details. This is a function version, which might be useful if you need to use this functionality from a scripting language, etc. Also, some of the macro versions call this function behind the scenes, where more heavy lifting can happen inside of SDL. Generally, though, an app written in C\/C++\/etc should use the macro version, as it will be more efficient. -- -- [Thread safety]: Obviously this function is safe to use from any thread at any time, but if you find yourself needing this, you are probably dealing with some very sensitive code; be careful! -- -- @since 3.2.0 -- -- [See also]: @SDL_MemoryBarrierRelease@ -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Unsafe__ foreign import of @SDL_MemoryBarrierReleaseFunction@. -- The safe flavor is 'memoryBarrierReleaseFunctionSafe' -- . -- -- [C declaration]: @SDL_MemoryBarrierReleaseFunction@, defined at @SDL3\/SDL_atomic.h 195:34@ memoryBarrierReleaseFunction :: IO () memoryBarrierReleaseFunction :: IO () memoryBarrierReleaseFunction = IO () Unsafe.sDL_MemoryBarrierReleaseFunction -- | Insert a memory release barrier (function version). -- -- Please refer to SDL_MemoryBarrierRelease for details. This is a function version, which might be useful if you need to use this functionality from a scripting language, etc. Also, some of the macro versions call this function behind the scenes, where more heavy lifting can happen inside of SDL. Generally, though, an app written in C\/C++\/etc should use the macro version, as it will be more efficient. -- -- [Thread safety]: Obviously this function is safe to use from any thread at any time, but if you find yourself needing this, you are probably dealing with some very sensitive code; be careful! -- -- @since 3.2.0 -- -- [See also]: @SDL_MemoryBarrierRelease@ -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Safe__ foreign import of @SDL_MemoryBarrierReleaseFunction@. -- The unsafe flavor is 'memoryBarrierReleaseFunction' -- . -- -- [C declaration]: @SDL_MemoryBarrierReleaseFunction@, defined at @SDL3\/SDL_atomic.h 195:34@ memoryBarrierReleaseFunctionSafe :: IO () memoryBarrierReleaseFunctionSafe :: IO () memoryBarrierReleaseFunctionSafe = IO () Safe.sDL_MemoryBarrierReleaseFunction -- | Insert a memory acquire barrier (function version). -- -- Please refer to SDL_MemoryBarrierRelease for details. This is a function version, which might be useful if you need to use this functionality from a scripting language, etc. Also, some of the macro versions call this function behind the scenes, where more heavy lifting can happen inside of SDL. Generally, though, an app written in C\/C++\/etc should use the macro version, as it will be more efficient. -- -- [Thread safety]: Obviously this function is safe to use from any thread at any time, but if you find yourself needing this, you are probably dealing with some very sensitive code; be careful! -- -- @since 3.2.0 -- -- [See also]: @SDL_MemoryBarrierAcquire@ -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Unsafe__ foreign import of @SDL_MemoryBarrierAcquireFunction@. -- The safe flavor is 'memoryBarrierAcquireFunctionSafe' -- . -- -- [C declaration]: @SDL_MemoryBarrierAcquireFunction@, defined at @SDL3\/SDL_atomic.h 215:34@ memoryBarrierAcquireFunction :: IO () memoryBarrierAcquireFunction :: IO () memoryBarrierAcquireFunction = IO () Unsafe.sDL_MemoryBarrierAcquireFunction -- | Insert a memory acquire barrier (function version). -- -- Please refer to SDL_MemoryBarrierRelease for details. This is a function version, which might be useful if you need to use this functionality from a scripting language, etc. Also, some of the macro versions call this function behind the scenes, where more heavy lifting can happen inside of SDL. Generally, though, an app written in C\/C++\/etc should use the macro version, as it will be more efficient. -- -- [Thread safety]: Obviously this function is safe to use from any thread at any time, but if you find yourself needing this, you are probably dealing with some very sensitive code; be careful! -- -- @since 3.2.0 -- -- [See also]: @SDL_MemoryBarrierAcquire@ -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Safe__ foreign import of @SDL_MemoryBarrierAcquireFunction@. -- The unsafe flavor is 'memoryBarrierAcquireFunction' -- . -- -- [C declaration]: @SDL_MemoryBarrierAcquireFunction@, defined at @SDL3\/SDL_atomic.h 215:34@ memoryBarrierAcquireFunctionSafe :: IO () memoryBarrierAcquireFunctionSafe :: IO () memoryBarrierAcquireFunctionSafe = IO () Safe.sDL_MemoryBarrierAcquireFunction -- | Set an atomic variable to a new value if it is currently an old value. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: true if the atomic variable was set, false otherwise. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'getAtomicInt', 'setAtomicInt' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Unsafe__ foreign import of @SDL_CompareAndSwapAtomicInt@. -- The safe flavor is 'compareAndSwapAtomicIntSafe' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @SDL_CompareAndSwapAtomicInt@, defined at @SDL3\/SDL_atomic.h 425:34@ compareAndSwapAtomicInt :: BG.Ptr SDL_AtomicInt -- ^ -- -- [@a@]: a pointer to an 'SDL_AtomicInt' variable to be modified. -> BG.Int32 -- ^ -- -- [@oldval@]: the old value. -> BG.Int32 -- ^ -- -- [@newval@]: the new value. -> IO Bool compareAndSwapAtomicInt :: Ptr SDL_AtomicInt -> Int32 -> Int32 -> IO Bool compareAndSwapAtomicInt = \Ptr SDL_AtomicInt x00 -> \Int32 x11 -> \Int32 x22 -> (CBool -> Bool) -> IO CBool -> IO Bool forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap CBool -> Bool forall b. (Eq b, Num b) => b -> Bool CBool.toBool (Ptr SDL_AtomicInt -> CInt -> CInt -> IO CBool Unsafe.sDL_CompareAndSwapAtomicInt Ptr SDL_AtomicInt x00 (Int32 -> CInt forall a b. Coercible a b => a -> b Coerce.coerce Int32 x11) (Int32 -> CInt forall a b. Coercible a b => a -> b Coerce.coerce Int32 x22)) -- | Set an atomic variable to a new value if it is currently an old value. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: true if the atomic variable was set, false otherwise. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'getAtomicInt', 'setAtomicInt' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Safe__ foreign import of @SDL_CompareAndSwapAtomicInt@. -- The unsafe flavor is 'compareAndSwapAtomicInt' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @SDL_CompareAndSwapAtomicInt@, defined at @SDL3\/SDL_atomic.h 425:34@ compareAndSwapAtomicIntSafe :: BG.Ptr SDL_AtomicInt -- ^ -- -- [@a@]: a pointer to an 'SDL_AtomicInt' variable to be modified. -> BG.Int32 -- ^ -- -- [@oldval@]: the old value. -> BG.Int32 -- ^ -- -- [@newval@]: the new value. -> IO Bool compareAndSwapAtomicIntSafe :: Ptr SDL_AtomicInt -> Int32 -> Int32 -> IO Bool compareAndSwapAtomicIntSafe = \Ptr SDL_AtomicInt x00 -> \Int32 x11 -> \Int32 x22 -> (CBool -> Bool) -> IO CBool -> IO Bool forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap CBool -> Bool forall b. (Eq b, Num b) => b -> Bool CBool.toBool (Ptr SDL_AtomicInt -> CInt -> CInt -> IO CBool Safe.sDL_CompareAndSwapAtomicInt Ptr SDL_AtomicInt x00 (Int32 -> CInt forall a b. Coercible a b => a -> b Coerce.coerce Int32 x11) (Int32 -> CInt forall a b. Coercible a b => a -> b Coerce.coerce Int32 x22)) -- | Set an atomic variable to a value. -- -- This function also acts as a full memory barrier. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: the previous value of the atomic variable. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'getAtomicInt' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Unsafe__ foreign import of @SDL_SetAtomicInt@. -- The safe flavor is 'setAtomicIntSafe' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @SDL_SetAtomicInt@, defined at @SDL3\/SDL_atomic.h 445:33@ setAtomicInt :: BG.Ptr SDL_AtomicInt -- ^ -- -- [@a@]: a pointer to an 'SDL_AtomicInt' variable to be modified. -> BG.Int32 -- ^ -- -- [@v@]: the desired value. -> IO BG.Int32 setAtomicInt :: Ptr SDL_AtomicInt -> Int32 -> IO Int32 setAtomicInt = \Ptr SDL_AtomicInt x00 -> \Int32 x11 -> (CInt -> Int32) -> IO CInt -> IO Int32 forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap CInt -> Int32 forall a b. Coercible a b => a -> b Coerce.coerce (Ptr SDL_AtomicInt -> CInt -> IO CInt Unsafe.sDL_SetAtomicInt Ptr SDL_AtomicInt x00 (Int32 -> CInt forall a b. Coercible a b => a -> b Coerce.coerce Int32 x11)) -- | Set an atomic variable to a value. -- -- This function also acts as a full memory barrier. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: the previous value of the atomic variable. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'getAtomicInt' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Safe__ foreign import of @SDL_SetAtomicInt@. -- The unsafe flavor is 'setAtomicInt' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @SDL_SetAtomicInt@, defined at @SDL3\/SDL_atomic.h 445:33@ setAtomicIntSafe :: BG.Ptr SDL_AtomicInt -- ^ -- -- [@a@]: a pointer to an 'SDL_AtomicInt' variable to be modified. -> BG.Int32 -- ^ -- -- [@v@]: the desired value. -> IO BG.Int32 setAtomicIntSafe :: Ptr SDL_AtomicInt -> Int32 -> IO Int32 setAtomicIntSafe = \Ptr SDL_AtomicInt x00 -> \Int32 x11 -> (CInt -> Int32) -> IO CInt -> IO Int32 forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap CInt -> Int32 forall a b. Coercible a b => a -> b Coerce.coerce (Ptr SDL_AtomicInt -> CInt -> IO CInt Safe.sDL_SetAtomicInt Ptr SDL_AtomicInt x00 (Int32 -> CInt forall a b. Coercible a b => a -> b Coerce.coerce Int32 x11)) -- | Get the value of an atomic variable. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: the current value of an atomic variable. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'setAtomicInt' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Unsafe__ foreign import of @SDL_GetAtomicInt@. -- The safe flavor is 'getAtomicIntSafe' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @SDL_GetAtomicInt@, defined at @SDL3\/SDL_atomic.h 462:33@ getAtomicInt :: BG.Ptr SDL_AtomicInt -- ^ -- -- [@a@]: a pointer to an 'SDL_AtomicInt' variable. -> IO BG.Int32 getAtomicInt :: Ptr SDL_AtomicInt -> IO Int32 getAtomicInt = \Ptr SDL_AtomicInt x00 -> (CInt -> Int32) -> IO CInt -> IO Int32 forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap CInt -> Int32 forall a b. Coercible a b => a -> b Coerce.coerce (Ptr SDL_AtomicInt -> IO CInt Unsafe.sDL_GetAtomicInt Ptr SDL_AtomicInt x00) -- | Get the value of an atomic variable. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: the current value of an atomic variable. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'setAtomicInt' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Safe__ foreign import of @SDL_GetAtomicInt@. -- The unsafe flavor is 'getAtomicInt' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @SDL_GetAtomicInt@, defined at @SDL3\/SDL_atomic.h 462:33@ getAtomicIntSafe :: BG.Ptr SDL_AtomicInt -- ^ -- -- [@a@]: a pointer to an 'SDL_AtomicInt' variable. -> IO BG.Int32 getAtomicIntSafe :: Ptr SDL_AtomicInt -> IO Int32 getAtomicIntSafe = \Ptr SDL_AtomicInt x00 -> (CInt -> Int32) -> IO CInt -> IO Int32 forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap CInt -> Int32 forall a b. Coercible a b => a -> b Coerce.coerce (Ptr SDL_AtomicInt -> IO CInt Safe.sDL_GetAtomicInt Ptr SDL_AtomicInt x00) -- | Add to an atomic variable. -- -- This function also acts as a full memory barrier. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: the previous value of the atomic variable. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: @'atomicDecRef'@, @'atomicIncRef'@ -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Unsafe__ foreign import of @SDL_AddAtomicInt@. -- The safe flavor is 'addAtomicIntSafe' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @SDL_AddAtomicInt@, defined at @SDL3\/SDL_atomic.h 483:33@ addAtomicInt :: BG.Ptr SDL_AtomicInt -- ^ -- -- [@a@]: a pointer to an 'SDL_AtomicInt' variable to be modified. -> BG.Int32 -- ^ -- -- [@v@]: the desired value to add. -> IO BG.Int32 addAtomicInt :: Ptr SDL_AtomicInt -> Int32 -> IO Int32 addAtomicInt = \Ptr SDL_AtomicInt x00 -> \Int32 x11 -> (CInt -> Int32) -> IO CInt -> IO Int32 forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap CInt -> Int32 forall a b. Coercible a b => a -> b Coerce.coerce (Ptr SDL_AtomicInt -> CInt -> IO CInt Unsafe.sDL_AddAtomicInt Ptr SDL_AtomicInt x00 (Int32 -> CInt forall a b. Coercible a b => a -> b Coerce.coerce Int32 x11)) -- | Add to an atomic variable. -- -- This function also acts as a full memory barrier. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: the previous value of the atomic variable. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: @'atomicDecRef'@, @'atomicIncRef'@ -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Safe__ foreign import of @SDL_AddAtomicInt@. -- The unsafe flavor is 'addAtomicInt' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @SDL_AddAtomicInt@, defined at @SDL3\/SDL_atomic.h 483:33@ addAtomicIntSafe :: BG.Ptr SDL_AtomicInt -- ^ -- -- [@a@]: a pointer to an 'SDL_AtomicInt' variable to be modified. -> BG.Int32 -- ^ -- -- [@v@]: the desired value to add. -> IO BG.Int32 addAtomicIntSafe :: Ptr SDL_AtomicInt -> Int32 -> IO Int32 addAtomicIntSafe = \Ptr SDL_AtomicInt x00 -> \Int32 x11 -> (CInt -> Int32) -> IO CInt -> IO Int32 forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap CInt -> Int32 forall a b. Coercible a b => a -> b Coerce.coerce (Ptr SDL_AtomicInt -> CInt -> IO CInt Safe.sDL_AddAtomicInt Ptr SDL_AtomicInt x00 (Int32 -> CInt forall a b. Coercible a b => a -> b Coerce.coerce Int32 x11)) -- | Set an atomic variable to a new value if it is currently an old value. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: true if the atomic variable was set, false otherwise. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'getAtomicU32', 'setAtomicU32' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Unsafe__ foreign import of @SDL_CompareAndSwapAtomicU32@. -- The safe flavor is 'compareAndSwapAtomicU32Safe' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @SDL_CompareAndSwapAtomicU32@, defined at @SDL3\/SDL_atomic.h 570:34@ compareAndSwapAtomicU32 :: BG.Ptr SDL_AtomicU32 -- ^ -- -- [@a@]: a pointer to an 'SDL_AtomicU32' variable to be modified. -> BG.Word32 -- ^ -- -- [@oldval@]: the old value. -> BG.Word32 -- ^ -- -- [@newval@]: the new value. -> IO Bool compareAndSwapAtomicU32 :: Ptr SDL_AtomicU32 -> Word32 -> Word32 -> IO Bool compareAndSwapAtomicU32 = \Ptr SDL_AtomicU32 x00 -> \Word32 x11 -> \Word32 x22 -> (CBool -> Bool) -> IO CBool -> IO Bool forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap CBool -> Bool forall b. (Eq b, Num b) => b -> Bool CBool.toBool (Ptr SDL_AtomicU32 -> Uint32 -> Uint32 -> IO CBool Unsafe.sDL_CompareAndSwapAtomicU32 Ptr SDL_AtomicU32 x00 (Word32 -> Uint32 forall a b. Coercible a b => a -> b Coerce.coerce Word32 x11) (Word32 -> Uint32 forall a b. Coercible a b => a -> b Coerce.coerce Word32 x22)) -- | Set an atomic variable to a new value if it is currently an old value. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: true if the atomic variable was set, false otherwise. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'getAtomicU32', 'setAtomicU32' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Safe__ foreign import of @SDL_CompareAndSwapAtomicU32@. -- The unsafe flavor is 'compareAndSwapAtomicU32' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @SDL_CompareAndSwapAtomicU32@, defined at @SDL3\/SDL_atomic.h 570:34@ compareAndSwapAtomicU32Safe :: BG.Ptr SDL_AtomicU32 -- ^ -- -- [@a@]: a pointer to an 'SDL_AtomicU32' variable to be modified. -> BG.Word32 -- ^ -- -- [@oldval@]: the old value. -> BG.Word32 -- ^ -- -- [@newval@]: the new value. -> IO Bool compareAndSwapAtomicU32Safe :: Ptr SDL_AtomicU32 -> Word32 -> Word32 -> IO Bool compareAndSwapAtomicU32Safe = \Ptr SDL_AtomicU32 x00 -> \Word32 x11 -> \Word32 x22 -> (CBool -> Bool) -> IO CBool -> IO Bool forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap CBool -> Bool forall b. (Eq b, Num b) => b -> Bool CBool.toBool (Ptr SDL_AtomicU32 -> Uint32 -> Uint32 -> IO CBool Safe.sDL_CompareAndSwapAtomicU32 Ptr SDL_AtomicU32 x00 (Word32 -> Uint32 forall a b. Coercible a b => a -> b Coerce.coerce Word32 x11) (Word32 -> Uint32 forall a b. Coercible a b => a -> b Coerce.coerce Word32 x22)) -- | Set an atomic variable to a value. -- -- This function also acts as a full memory barrier. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: the previous value of the atomic variable. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'getAtomicU32' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Unsafe__ foreign import of @SDL_SetAtomicU32@. -- The safe flavor is 'setAtomicU32Safe' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @SDL_SetAtomicU32@, defined at @SDL3\/SDL_atomic.h 590:36@ setAtomicU32 :: BG.Ptr SDL_AtomicU32 -- ^ -- -- [@a@]: a pointer to an 'SDL_AtomicU32' variable to be modified. -> BG.Word32 -- ^ -- -- [@v@]: the desired value. -> IO BG.Word32 setAtomicU32 :: Ptr SDL_AtomicU32 -> Word32 -> IO Word32 setAtomicU32 = \Ptr SDL_AtomicU32 x00 -> \Word32 x11 -> (Uint32 -> Word32) -> IO Uint32 -> IO Word32 forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap Uint32 -> Word32 forall a b. Coercible a b => a -> b Coerce.coerce (Ptr SDL_AtomicU32 -> Uint32 -> IO Uint32 Unsafe.sDL_SetAtomicU32 Ptr SDL_AtomicU32 x00 (Word32 -> Uint32 forall a b. Coercible a b => a -> b Coerce.coerce Word32 x11)) -- | Set an atomic variable to a value. -- -- This function also acts as a full memory barrier. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: the previous value of the atomic variable. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'getAtomicU32' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Safe__ foreign import of @SDL_SetAtomicU32@. -- The unsafe flavor is 'setAtomicU32' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @SDL_SetAtomicU32@, defined at @SDL3\/SDL_atomic.h 590:36@ setAtomicU32Safe :: BG.Ptr SDL_AtomicU32 -- ^ -- -- [@a@]: a pointer to an 'SDL_AtomicU32' variable to be modified. -> BG.Word32 -- ^ -- -- [@v@]: the desired value. -> IO BG.Word32 setAtomicU32Safe :: Ptr SDL_AtomicU32 -> Word32 -> IO Word32 setAtomicU32Safe = \Ptr SDL_AtomicU32 x00 -> \Word32 x11 -> (Uint32 -> Word32) -> IO Uint32 -> IO Word32 forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap Uint32 -> Word32 forall a b. Coercible a b => a -> b Coerce.coerce (Ptr SDL_AtomicU32 -> Uint32 -> IO Uint32 Safe.sDL_SetAtomicU32 Ptr SDL_AtomicU32 x00 (Word32 -> Uint32 forall a b. Coercible a b => a -> b Coerce.coerce Word32 x11)) -- | Get the value of an atomic variable. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: the current value of an atomic variable. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'setAtomicU32' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Unsafe__ foreign import of @SDL_GetAtomicU32@. -- The safe flavor is 'getAtomicU32Safe' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @SDL_GetAtomicU32@, defined at @SDL3\/SDL_atomic.h 607:36@ getAtomicU32 :: BG.Ptr SDL_AtomicU32 -- ^ -- -- [@a@]: a pointer to an 'SDL_AtomicU32' variable. -> IO BG.Word32 getAtomicU32 :: Ptr SDL_AtomicU32 -> IO Word32 getAtomicU32 = \Ptr SDL_AtomicU32 x00 -> (Uint32 -> Word32) -> IO Uint32 -> IO Word32 forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap Uint32 -> Word32 forall a b. Coercible a b => a -> b Coerce.coerce (Ptr SDL_AtomicU32 -> IO Uint32 Unsafe.sDL_GetAtomicU32 Ptr SDL_AtomicU32 x00) -- | Get the value of an atomic variable. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: the current value of an atomic variable. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'setAtomicU32' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Safe__ foreign import of @SDL_GetAtomicU32@. -- The unsafe flavor is 'getAtomicU32' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @SDL_GetAtomicU32@, defined at @SDL3\/SDL_atomic.h 607:36@ getAtomicU32Safe :: BG.Ptr SDL_AtomicU32 -- ^ -- -- [@a@]: a pointer to an 'SDL_AtomicU32' variable. -> IO BG.Word32 getAtomicU32Safe :: Ptr SDL_AtomicU32 -> IO Word32 getAtomicU32Safe = \Ptr SDL_AtomicU32 x00 -> (Uint32 -> Word32) -> IO Uint32 -> IO Word32 forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap Uint32 -> Word32 forall a b. Coercible a b => a -> b Coerce.coerce (Ptr SDL_AtomicU32 -> IO Uint32 Safe.sDL_GetAtomicU32 Ptr SDL_AtomicU32 x00) -- | Add to an atomic variable. -- -- This function also acts as a full memory barrier. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: the previous value of the atomic variable. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.4.0 -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Unsafe__ foreign import of @SDL_AddAtomicU32@. -- The safe flavor is 'addAtomicU32Safe' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @SDL_AddAtomicU32@, defined at @SDL3\/SDL_atomic.h 625:36@ addAtomicU32 :: BG.Ptr SDL_AtomicU32 -- ^ -- -- [@a@]: a pointer to an 'SDL_AtomicU32' variable to be modified. -> BG.Int32 -- ^ -- -- [@v@]: the desired value to add or subtract. -> IO BG.Word32 addAtomicU32 :: Ptr SDL_AtomicU32 -> Int32 -> IO Word32 addAtomicU32 = \Ptr SDL_AtomicU32 x00 -> \Int32 x11 -> (Uint32 -> Word32) -> IO Uint32 -> IO Word32 forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap Uint32 -> Word32 forall a b. Coercible a b => a -> b Coerce.coerce (Ptr SDL_AtomicU32 -> CInt -> IO Uint32 Unsafe.sDL_AddAtomicU32 Ptr SDL_AtomicU32 x00 (Int32 -> CInt forall a b. Coercible a b => a -> b Coerce.coerce Int32 x11)) -- | Add to an atomic variable. -- -- This function also acts as a full memory barrier. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: the previous value of the atomic variable. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.4.0 -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Safe__ foreign import of @SDL_AddAtomicU32@. -- The unsafe flavor is 'addAtomicU32' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @SDL_AddAtomicU32@, defined at @SDL3\/SDL_atomic.h 625:36@ addAtomicU32Safe :: BG.Ptr SDL_AtomicU32 -- ^ -- -- [@a@]: a pointer to an 'SDL_AtomicU32' variable to be modified. -> BG.Int32 -- ^ -- -- [@v@]: the desired value to add or subtract. -> IO BG.Word32 addAtomicU32Safe :: Ptr SDL_AtomicU32 -> Int32 -> IO Word32 addAtomicU32Safe = \Ptr SDL_AtomicU32 x00 -> \Int32 x11 -> (Uint32 -> Word32) -> IO Uint32 -> IO Word32 forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap Uint32 -> Word32 forall a b. Coercible a b => a -> b Coerce.coerce (Ptr SDL_AtomicU32 -> CInt -> IO Uint32 Safe.sDL_AddAtomicU32 Ptr SDL_AtomicU32 x00 (Int32 -> CInt forall a b. Coercible a b => a -> b Coerce.coerce Int32 x11)) -- | Set a pointer to a new value if it is currently an old value. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: true if the pointer was set, false otherwise. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'compareAndSwapAtomicInt', 'getAtomicPointer', 'setAtomicPointer' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Unsafe__ foreign import of @SDL_CompareAndSwapAtomicPointer@. -- The safe flavor is 'compareAndSwapAtomicPointerSafe' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @SDL_CompareAndSwapAtomicPointer@, defined at @SDL3\/SDL_atomic.h 646:34@ compareAndSwapAtomicPointer :: BG.Ptr (BG.Ptr BG.Void) -- ^ -- -- [@a@]: a pointer to a pointer. -> BG.Ptr BG.Void -- ^ -- -- [@oldval@]: the old pointer value. -> BG.Ptr BG.Void -- ^ -- -- [@newval@]: the new pointer value. -> IO Bool compareAndSwapAtomicPointer :: Ptr (Ptr Void) -> Ptr Void -> Ptr Void -> IO Bool compareAndSwapAtomicPointer = \Ptr (Ptr Void) x00 -> \Ptr Void x11 -> \Ptr Void x22 -> (CBool -> Bool) -> IO CBool -> IO Bool forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap CBool -> Bool forall b. (Eq b, Num b) => b -> Bool CBool.toBool (Ptr (Ptr Void) -> Ptr Void -> Ptr Void -> IO CBool Unsafe.sDL_CompareAndSwapAtomicPointer Ptr (Ptr Void) x00 Ptr Void x11 Ptr Void x22) -- | Set a pointer to a new value if it is currently an old value. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: true if the pointer was set, false otherwise. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'compareAndSwapAtomicInt', 'getAtomicPointer', 'setAtomicPointer' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Safe__ foreign import of @SDL_CompareAndSwapAtomicPointer@. -- The unsafe flavor is 'compareAndSwapAtomicPointer' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @SDL_CompareAndSwapAtomicPointer@, defined at @SDL3\/SDL_atomic.h 646:34@ compareAndSwapAtomicPointerSafe :: BG.Ptr (BG.Ptr BG.Void) -- ^ -- -- [@a@]: a pointer to a pointer. -> BG.Ptr BG.Void -- ^ -- -- [@oldval@]: the old pointer value. -> BG.Ptr BG.Void -- ^ -- -- [@newval@]: the new pointer value. -> IO Bool compareAndSwapAtomicPointerSafe :: Ptr (Ptr Void) -> Ptr Void -> Ptr Void -> IO Bool compareAndSwapAtomicPointerSafe = \Ptr (Ptr Void) x00 -> \Ptr Void x11 -> \Ptr Void x22 -> (CBool -> Bool) -> IO CBool -> IO Bool forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap CBool -> Bool forall b. (Eq b, Num b) => b -> Bool CBool.toBool (Ptr (Ptr Void) -> Ptr Void -> Ptr Void -> IO CBool Safe.sDL_CompareAndSwapAtomicPointer Ptr (Ptr Void) x00 Ptr Void x11 Ptr Void x22) -- | Set a pointer to a value atomically. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: the previous value of the pointer. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'compareAndSwapAtomicPointer', 'getAtomicPointer' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Unsafe__ foreign import of @SDL_SetAtomicPointer@. -- The safe flavor is 'setAtomicPointerSafe' -- . -- -- [C declaration]: @SDL_SetAtomicPointer@, defined at @SDL3\/SDL_atomic.h 665:36@ setAtomicPointer :: BG.Ptr (BG.Ptr BG.Void) -- ^ -- -- [@a@]: a pointer to a pointer. -> BG.Ptr BG.Void -- ^ -- -- [@v@]: the desired pointer value. -> IO (BG.Ptr BG.Void) setAtomicPointer :: Ptr (Ptr Void) -> Ptr Void -> IO (Ptr Void) setAtomicPointer = Ptr (Ptr Void) -> Ptr Void -> IO (Ptr Void) Unsafe.sDL_SetAtomicPointer -- | Set a pointer to a value atomically. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: the previous value of the pointer. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'compareAndSwapAtomicPointer', 'getAtomicPointer' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Safe__ foreign import of @SDL_SetAtomicPointer@. -- The unsafe flavor is 'setAtomicPointer' -- . -- -- [C declaration]: @SDL_SetAtomicPointer@, defined at @SDL3\/SDL_atomic.h 665:36@ setAtomicPointerSafe :: BG.Ptr (BG.Ptr BG.Void) -- ^ -- -- [@a@]: a pointer to a pointer. -> BG.Ptr BG.Void -- ^ -- -- [@v@]: the desired pointer value. -> IO (BG.Ptr BG.Void) setAtomicPointerSafe :: Ptr (Ptr Void) -> Ptr Void -> IO (Ptr Void) setAtomicPointerSafe = Ptr (Ptr Void) -> Ptr Void -> IO (Ptr Void) Safe.sDL_SetAtomicPointer -- | Get the value of a pointer atomically. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: the current value of a pointer. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'compareAndSwapAtomicPointer', 'setAtomicPointer' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Unsafe__ foreign import of @SDL_GetAtomicPointer@. -- The safe flavor is 'getAtomicPointerSafe' -- . -- -- [C declaration]: @SDL_GetAtomicPointer@, defined at @SDL3\/SDL_atomic.h 683:36@ getAtomicPointer :: BG.Ptr (BG.Ptr BG.Void) -- ^ -- -- [@a@]: a pointer to a pointer. -> IO (BG.Ptr BG.Void) getAtomicPointer :: Ptr (Ptr Void) -> IO (Ptr Void) getAtomicPointer = Ptr (Ptr Void) -> IO (Ptr Void) Unsafe.sDL_GetAtomicPointer -- | Get the value of a pointer atomically. -- -- /__Note: If you don\'t know what this function is for, you shouldn\'t use it!__/ -- -- [Returns]: the current value of a pointer. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'compareAndSwapAtomicPointer', 'setAtomicPointer' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Safe__ foreign import of @SDL_GetAtomicPointer@. -- The unsafe flavor is 'getAtomicPointer' -- . -- -- [C declaration]: @SDL_GetAtomicPointer@, defined at @SDL3\/SDL_atomic.h 683:36@ getAtomicPointerSafe :: BG.Ptr (BG.Ptr BG.Void) -- ^ -- -- [@a@]: a pointer to a pointer. -> IO (BG.Ptr BG.Void) getAtomicPointerSafe :: Ptr (Ptr Void) -> IO (Ptr Void) getAtomicPointerSafe = Ptr (Ptr Void) -> IO (Ptr Void) Safe.sDL_GetAtomicPointer -- | Increment an atomic variable used as a reference count. -- -- The SDL_AtomicIncRef macro as a function. -- -- [Returns]: the previous value of the atomic variable. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'atomicDecRef' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Unsafe__ foreign import of @lithon_SDL_AtomicIncRef@. -- The safe flavor is 'atomicIncRefSafe' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @lithon_SDL_AtomicIncRef@, defined at @sdl3-bindgen-sys\/SDL_atomic_shims.h 38:23@ atomicIncRef :: BG.Ptr SDL3.Sys.Bindgen.Atomic.SDL_AtomicInt -- ^ -- -- [@a@]: a pointer to an SDL_AtomicInt to increment. -> IO BG.Int32 atomicIncRef :: Ptr SDL_AtomicInt -> IO Int32 atomicIncRef = \Ptr SDL_AtomicInt x00 -> (CInt -> Int32) -> IO CInt -> IO Int32 forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap CInt -> Int32 forall a b. Coercible a b => a -> b Coerce.coerce (Ptr SDL_AtomicInt -> IO CInt Unsafe.lithon_SDL_AtomicIncRef Ptr SDL_AtomicInt x00) -- | Increment an atomic variable used as a reference count. -- -- The SDL_AtomicIncRef macro as a function. -- -- [Returns]: the previous value of the atomic variable. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'atomicDecRef' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Safe__ foreign import of @lithon_SDL_AtomicIncRef@. -- The unsafe flavor is 'atomicIncRef' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @lithon_SDL_AtomicIncRef@, defined at @sdl3-bindgen-sys\/SDL_atomic_shims.h 38:23@ atomicIncRefSafe :: BG.Ptr SDL3.Sys.Bindgen.Atomic.SDL_AtomicInt -- ^ -- -- [@a@]: a pointer to an SDL_AtomicInt to increment. -> IO BG.Int32 atomicIncRefSafe :: Ptr SDL_AtomicInt -> IO Int32 atomicIncRefSafe = \Ptr SDL_AtomicInt x00 -> (CInt -> Int32) -> IO CInt -> IO Int32 forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap CInt -> Int32 forall a b. Coercible a b => a -> b Coerce.coerce (Ptr SDL_AtomicInt -> IO CInt Safe.lithon_SDL_AtomicIncRef Ptr SDL_AtomicInt x00) -- | Decrement an atomic variable used as a reference count. -- -- The SDL_AtomicDecRef macro as a function. -- -- [Returns]: true if the variable reached zero after decrementing, false otherwise. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'atomicIncRef' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Unsafe__ foreign import of @lithon_SDL_AtomicDecRef@. -- The safe flavor is 'atomicDecRefSafe' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @lithon_SDL_AtomicDecRef@, defined at @sdl3-bindgen-sys\/SDL_atomic_shims.h 58:24@ atomicDecRef :: BG.Ptr SDL3.Sys.Bindgen.Atomic.SDL_AtomicInt -- ^ -- -- [@a@]: a pointer to an SDL_AtomicInt to decrement. -> IO Bool atomicDecRef :: Ptr SDL_AtomicInt -> IO Bool atomicDecRef = \Ptr SDL_AtomicInt x00 -> (CBool -> Bool) -> IO CBool -> IO Bool forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap CBool -> Bool forall b. (Eq b, Num b) => b -> Bool CBool.toBool (Ptr SDL_AtomicInt -> IO CBool Unsafe.lithon_SDL_AtomicDecRef Ptr SDL_AtomicInt x00) -- | Decrement an atomic variable used as a reference count. -- -- The SDL_AtomicDecRef macro as a function. -- -- [Returns]: true if the variable reached zero after decrementing, false otherwise. -- -- [Thread safety]: It is safe to call this function from any thread. -- -- @since 3.2.0 -- -- [See also]: 'atomicIncRef' -- -- === __@sdl3-bindgen-sys@ notes__ -- -- [FFI safety]: __Safe__ foreign import of @lithon_SDL_AtomicDecRef@. -- The unsafe flavor is 'atomicDecRef' -- . -- -- [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function. -- Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate. -- -- [C declaration]: @lithon_SDL_AtomicDecRef@, defined at @sdl3-bindgen-sys\/SDL_atomic_shims.h 58:24@ atomicDecRefSafe :: BG.Ptr SDL3.Sys.Bindgen.Atomic.SDL_AtomicInt -- ^ -- -- [@a@]: a pointer to an SDL_AtomicInt to decrement. -> IO Bool atomicDecRefSafe :: Ptr SDL_AtomicInt -> IO Bool atomicDecRefSafe = \Ptr SDL_AtomicInt x00 -> (CBool -> Bool) -> IO CBool -> IO Bool forall a b. (a -> b) -> IO a -> IO b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap CBool -> Bool forall b. (Eq b, Num b) => b -> Bool CBool.toBool (Ptr SDL_AtomicInt -> IO CBool Safe.lithon_SDL_AtomicDecRef Ptr SDL_AtomicInt x00)