sdl3-bindgen-sys
Safe HaskellNone
LanguageGHC2021

SDL3.Sys.Bindgen.Atomic.FunPtr

Synopsis

Documentation

sDL_TryLockSpinlock :: FunPtr (Ptr SDL_SpinLock -> IO CBool) Source #

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!

lock
a pointer to a lock variable.
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.
See also
sDL_LockSpinlock, sDL_UnlockSpinlock
C declaration
SDL_TryLockSpinlock, defined at SDL3/SDL_atomic.h 100:34

Since: 3.2.0

sDL_LockSpinlock :: FunPtr (Ptr SDL_SpinLock -> IO ()) Source #

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!

lock
a pointer to a lock variable.
Thread safety
It is safe to call this function from any thread.
See also
sDL_TryLockSpinlock, sDL_UnlockSpinlock
C declaration
SDL_LockSpinlock, defined at SDL3/SDL_atomic.h 117:34

Since: 3.2.0

sDL_UnlockSpinlock :: FunPtr (Ptr SDL_SpinLock -> IO ()) Source #

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!

lock
a pointer to a lock variable.
Thread safety
It is safe to call this function from any thread.
See also
sDL_LockSpinlock, sDL_TryLockSpinlock
C declaration
SDL_UnlockSpinlock, defined at SDL3/SDL_atomic.h 136:34

Since: 3.2.0

sDL_MemoryBarrierReleaseFunction :: FunPtr (IO ()) Source #

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!
See also
SDL_MemoryBarrierRelease
C declaration
SDL_MemoryBarrierReleaseFunction, defined at SDL3/SDL_atomic.h 195:34

Since: 3.2.0

sDL_MemoryBarrierAcquireFunction :: FunPtr (IO ()) Source #

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!
See also
SDL_MemoryBarrierAcquire
C declaration
SDL_MemoryBarrierAcquireFunction, defined at SDL3/SDL_atomic.h 215:34

Since: 3.2.0

sDL_CompareAndSwapAtomicInt :: FunPtr (Ptr SDL_AtomicInt -> CInt -> CInt -> IO CBool) Source #

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!

a
a pointer to an SDL_AtomicInt variable to be modified.
oldval
the old value.
newval
the new value.
Returns
true if the atomic variable was set, false otherwise.
Thread safety
It is safe to call this function from any thread.
See also
sDL_GetAtomicInt, sDL_SetAtomicInt
C declaration
SDL_CompareAndSwapAtomicInt, defined at SDL3/SDL_atomic.h 425:34

Since: 3.2.0

sDL_SetAtomicInt :: FunPtr (Ptr SDL_AtomicInt -> CInt -> IO CInt) Source #

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!

a
a pointer to an SDL_AtomicInt variable to be modified.
v
the desired value.
Returns
the previous value of the atomic variable.
Thread safety
It is safe to call this function from any thread.
See also
sDL_GetAtomicInt
C declaration
SDL_SetAtomicInt, defined at SDL3/SDL_atomic.h 445:33

Since: 3.2.0

sDL_GetAtomicInt :: FunPtr (Ptr SDL_AtomicInt -> IO CInt) Source #

Get the value of an atomic variable.

Note: If you don't know what this function is for, you shouldn't use it!

a
a pointer to an SDL_AtomicInt variable.
Returns
the current value of an atomic variable.
Thread safety
It is safe to call this function from any thread.
See also
sDL_SetAtomicInt
C declaration
SDL_GetAtomicInt, defined at SDL3/SDL_atomic.h 462:33

Since: 3.2.0

sDL_AddAtomicInt :: FunPtr (Ptr SDL_AtomicInt -> CInt -> IO CInt) Source #

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!

a
a pointer to an SDL_AtomicInt variable to be modified.
v
the desired value to add.
Returns
the previous value of the atomic variable.
Thread safety
It is safe to call this function from any thread.
See also
SDL_AtomicDecRef, SDL_AtomicIncRef
C declaration
SDL_AddAtomicInt, defined at SDL3/SDL_atomic.h 483:33

Since: 3.2.0

sDL_CompareAndSwapAtomicU32 :: FunPtr (Ptr SDL_AtomicU32 -> Uint32 -> Uint32 -> IO CBool) Source #

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!

a
a pointer to an SDL_AtomicU32 variable to be modified.
oldval
the old value.
newval
the new value.
Returns
true if the atomic variable was set, false otherwise.
Thread safety
It is safe to call this function from any thread.
See also
sDL_GetAtomicU32, sDL_SetAtomicU32
C declaration
SDL_CompareAndSwapAtomicU32, defined at SDL3/SDL_atomic.h 570:34

Since: 3.2.0

sDL_SetAtomicU32 :: FunPtr (Ptr SDL_AtomicU32 -> Uint32 -> IO Uint32) Source #

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!

a
a pointer to an SDL_AtomicU32 variable to be modified.
v
the desired value.
Returns
the previous value of the atomic variable.
Thread safety
It is safe to call this function from any thread.
See also
sDL_GetAtomicU32
C declaration
SDL_SetAtomicU32, defined at SDL3/SDL_atomic.h 590:36

Since: 3.2.0

sDL_GetAtomicU32 :: FunPtr (Ptr SDL_AtomicU32 -> IO Uint32) Source #

Get the value of an atomic variable.

Note: If you don't know what this function is for, you shouldn't use it!

a
a pointer to an SDL_AtomicU32 variable.
Returns
the current value of an atomic variable.
Thread safety
It is safe to call this function from any thread.
See also
sDL_SetAtomicU32
C declaration
SDL_GetAtomicU32, defined at SDL3/SDL_atomic.h 607:36

Since: 3.2.0

sDL_AddAtomicU32 :: FunPtr (Ptr SDL_AtomicU32 -> CInt -> IO Uint32) Source #

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!

a
a pointer to an SDL_AtomicU32 variable to be modified.
v
the desired value to add or subtract.
Returns
the previous value of the atomic variable.
Thread safety
It is safe to call this function from any thread.
C declaration
SDL_AddAtomicU32, defined at SDL3/SDL_atomic.h 625:36

Since: 3.4.0

sDL_CompareAndSwapAtomicPointer :: FunPtr (Ptr (Ptr Void) -> Ptr Void -> Ptr Void -> IO CBool) Source #

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!

a
a pointer to a pointer.
oldval
the old pointer value.
newval
the new pointer value.
Returns
true if the pointer was set, false otherwise.
Thread safety
It is safe to call this function from any thread.
See also
sDL_CompareAndSwapAtomicInt, sDL_GetAtomicPointer, sDL_SetAtomicPointer
C declaration
SDL_CompareAndSwapAtomicPointer, defined at SDL3/SDL_atomic.h 646:34

Since: 3.2.0

sDL_SetAtomicPointer :: FunPtr (Ptr (Ptr Void) -> Ptr Void -> IO (Ptr Void)) Source #

Set a pointer to a value atomically.

Note: If you don't know what this function is for, you shouldn't use it!

a
a pointer to a pointer.
v
the desired pointer value.
Returns
the previous value of the pointer.
Thread safety
It is safe to call this function from any thread.
See also
sDL_CompareAndSwapAtomicPointer, sDL_GetAtomicPointer
C declaration
SDL_SetAtomicPointer, defined at SDL3/SDL_atomic.h 665:36

Since: 3.2.0

sDL_GetAtomicPointer :: FunPtr (Ptr (Ptr Void) -> IO (Ptr Void)) Source #

Get the value of a pointer atomically.

Note: If you don't know what this function is for, you shouldn't use it!

a
a pointer to a pointer.
Returns
the current value of a pointer.
Thread safety
It is safe to call this function from any thread.
See also
sDL_CompareAndSwapAtomicPointer, sDL_SetAtomicPointer
C declaration
SDL_GetAtomicPointer, defined at SDL3/SDL_atomic.h 683:36

Since: 3.2.0