| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
SDL3.Sys.Mutex
Contents
Description
Thread synchronization primitives: mutexes, semaphores, condition variables, and read/write locks.
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.Mutex.Unsafe); functions curated unsafe-only export only the unsuffixed one. Each alias's documentation records its flavor and rationale.
Full conventions: SDL3.Sys.
Synopsis
- module SDL3.Sys.Bindgen.Mutex
- createMutex :: IO (Ptr SDL_Mutex)
- createMutexSafe :: IO (Ptr SDL_Mutex)
- lockMutex :: Ptr SDL_Mutex -> IO ()
- lockMutexSafe :: Ptr SDL_Mutex -> IO ()
- tryLockMutex :: Ptr SDL_Mutex -> IO Bool
- tryLockMutexSafe :: Ptr SDL_Mutex -> IO Bool
- unlockMutex :: Ptr SDL_Mutex -> IO ()
- unlockMutexSafe :: Ptr SDL_Mutex -> IO ()
- destroyMutex :: Ptr SDL_Mutex -> IO ()
- destroyMutexSafe :: Ptr SDL_Mutex -> IO ()
- createRWLock :: IO (Ptr SDL_RWLock)
- createRWLockSafe :: IO (Ptr SDL_RWLock)
- lockRWLockForReading :: Ptr SDL_RWLock -> IO ()
- lockRWLockForReadingSafe :: Ptr SDL_RWLock -> IO ()
- lockRWLockForWriting :: Ptr SDL_RWLock -> IO ()
- lockRWLockForWritingSafe :: Ptr SDL_RWLock -> IO ()
- tryLockRWLockForReading :: Ptr SDL_RWLock -> IO Bool
- tryLockRWLockForReadingSafe :: Ptr SDL_RWLock -> IO Bool
- tryLockRWLockForWriting :: Ptr SDL_RWLock -> IO Bool
- tryLockRWLockForWritingSafe :: Ptr SDL_RWLock -> IO Bool
- unlockRWLock :: Ptr SDL_RWLock -> IO ()
- unlockRWLockSafe :: Ptr SDL_RWLock -> IO ()
- destroyRWLock :: Ptr SDL_RWLock -> IO ()
- destroyRWLockSafe :: Ptr SDL_RWLock -> IO ()
- createSemaphore :: Word32 -> IO (Ptr SDL_Semaphore)
- createSemaphoreSafe :: Word32 -> IO (Ptr SDL_Semaphore)
- destroySemaphore :: Ptr SDL_Semaphore -> IO ()
- destroySemaphoreSafe :: Ptr SDL_Semaphore -> IO ()
- waitSemaphore :: Ptr SDL_Semaphore -> IO ()
- waitSemaphoreSafe :: Ptr SDL_Semaphore -> IO ()
- tryWaitSemaphore :: Ptr SDL_Semaphore -> IO Bool
- tryWaitSemaphoreSafe :: Ptr SDL_Semaphore -> IO Bool
- waitSemaphoreTimeout :: Ptr SDL_Semaphore -> Int32 -> IO Bool
- waitSemaphoreTimeoutSafe :: Ptr SDL_Semaphore -> Int32 -> IO Bool
- signalSemaphore :: Ptr SDL_Semaphore -> IO ()
- signalSemaphoreSafe :: Ptr SDL_Semaphore -> IO ()
- getSemaphoreValue :: Ptr SDL_Semaphore -> IO Word32
- getSemaphoreValueSafe :: Ptr SDL_Semaphore -> IO Word32
- createCondition :: IO (Ptr SDL_Condition)
- createConditionSafe :: IO (Ptr SDL_Condition)
- destroyCondition :: Ptr SDL_Condition -> IO ()
- destroyConditionSafe :: Ptr SDL_Condition -> IO ()
- signalCondition :: Ptr SDL_Condition -> IO ()
- signalConditionSafe :: Ptr SDL_Condition -> IO ()
- broadcastCondition :: Ptr SDL_Condition -> IO ()
- broadcastConditionSafe :: Ptr SDL_Condition -> IO ()
- waitCondition :: Ptr SDL_Condition -> Ptr SDL_Mutex -> IO ()
- waitConditionSafe :: Ptr SDL_Condition -> Ptr SDL_Mutex -> IO ()
- waitConditionTimeout :: Ptr SDL_Condition -> Ptr SDL_Mutex -> Int32 -> IO Bool
- waitConditionTimeoutSafe :: Ptr SDL_Condition -> Ptr SDL_Mutex -> Int32 -> IO Bool
- shouldInit :: Ptr SDL_InitState -> IO Bool
- shouldInitSafe :: Ptr SDL_InitState -> IO Bool
- shouldQuit :: Ptr SDL_InitState -> IO Bool
- shouldQuitSafe :: Ptr SDL_InitState -> IO Bool
- setInitialized :: Ptr SDL_InitState -> Bool -> IO ()
- setInitializedSafe :: Ptr SDL_InitState -> Bool -> IO ()
Documentation
module SDL3.Sys.Bindgen.Mutex
Function aliases
createMutex :: IO (Ptr SDL_Mutex) Source #
Create a new mutex.
All newly-created mutexes begin in the unlocked state.
Calls to will not return while the mutex is locked by another thread. See lockMutex to attempt to lock without blocking.tryLockMutex
SDL mutexes are reentrant.
- Returns
- the initialized and unlocked mutex or NULL on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
destroyMutex,lockMutex,tryLockMutex,unlockMutex
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_CreateMutex. The safe flavor iscreateMutexSafe. - C declaration
SDL_CreateMutex, defined atSDL3/SDL_mutex.h 320:41
Since: 3.2.0
createMutexSafe :: IO (Ptr SDL_Mutex) Source #
Create a new mutex.
All newly-created mutexes begin in the unlocked state.
Calls to will not return while the mutex is locked by another thread. See lockMutex to attempt to lock without blocking.tryLockMutex
SDL mutexes are reentrant.
- Returns
- the initialized and unlocked mutex or NULL on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
destroyMutex,lockMutex,tryLockMutex,unlockMutex
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_CreateMutex. The unsafe flavor iscreateMutex. - C declaration
SDL_CreateMutex, defined atSDL3/SDL_mutex.h 320:41
Since: 3.2.0
Lock the mutex.
This will block until the mutex is available, which is to say it is in the unlocked state and the OS has chosen the caller as the next thread to lock it. Of all threads waiting to lock the mutex, only one may do so at a time.
It is legal for the owning thread to lock an already-locked mutex. It must unlock it the same number of times before it is actually made available for other threads in the system (this is known as a "recursive mutex").
This function does not fail; if mutex is NULL, it will return immediately having locked nothing. If the mutex is valid, this function will always block until it can lock the mutex, and return with it locked.
- Thread safety
- It is safe to call this function from any thread.
- See also
tryLockMutex,unlockMutex
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_LockMutex. The safe flavor islockMutexSafe: blocks on contention. - C declaration
SDL_LockMutex, defined atSDL3/SDL_mutex.h 346:34
Since: 3.2.0
Lock the mutex.
This will block until the mutex is available, which is to say it is in the unlocked state and the OS has chosen the caller as the next thread to lock it. Of all threads waiting to lock the mutex, only one may do so at a time.
It is legal for the owning thread to lock an already-locked mutex. It must unlock it the same number of times before it is actually made available for other threads in the system (this is known as a "recursive mutex").
This function does not fail; if mutex is NULL, it will return immediately having locked nothing. If the mutex is valid, this function will always block until it can lock the mutex, and return with it locked.
- Thread safety
- It is safe to call this function from any thread.
- See also
tryLockMutex,unlockMutex
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_LockMutex. The unsafe flavor islockMutex: blocks on contention. - C declaration
SDL_LockMutex, defined atSDL3/SDL_mutex.h 346:34
Since: 3.2.0
Try to lock a mutex without blocking.
This works just like , but if the mutex is not available, this function returns false immediately.lockMutex
This technique is useful if you need exclusive access to a resource but don't want to wait for it, and will return to it to try again later.
This function returns true if passed a NULL mutex.
- Returns
- true on success, false if the mutex would block.
- Thread safety
- It is safe to call this function from any thread.
- See also
lockMutex,unlockMutex
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_TryLockMutex. The safe flavor istryLockMutexSafe. - 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_TryLockMutex, defined atSDL3/SDL_mutex.h 369:34
Since: 3.2.0
Try to lock a mutex without blocking.
This works just like , but if the mutex is not available, this function returns false immediately.lockMutex
This technique is useful if you need exclusive access to a resource but don't want to wait for it, and will return to it to try again later.
This function returns true if passed a NULL mutex.
- Returns
- true on success, false if the mutex would block.
- Thread safety
- It is safe to call this function from any thread.
- See also
lockMutex,unlockMutex
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_TryLockMutex. The unsafe flavor istryLockMutex. - 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_TryLockMutex, defined atSDL3/SDL_mutex.h 369:34
Since: 3.2.0
Unlock the mutex.
It is legal for the owning thread to lock an already-locked mutex. It must unlock it the same number of times before it is actually made available for other threads in the system (this is known as a "recursive mutex").
It is illegal to unlock a mutex that has not been locked by the current thread, and doing so results in undefined behavior.
- Thread safety
- This call must be paired with a previous locking call on the same thread.
- See also
lockMutex,tryLockMutex
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_UnlockMutex. The safe flavor isunlockMutexSafe. - C declaration
SDL_UnlockMutex, defined atSDL3/SDL_mutex.h 391:34
Since: 3.2.0
Unlock the mutex.
It is legal for the owning thread to lock an already-locked mutex. It must unlock it the same number of times before it is actually made available for other threads in the system (this is known as a "recursive mutex").
It is illegal to unlock a mutex that has not been locked by the current thread, and doing so results in undefined behavior.
- Thread safety
- This call must be paired with a previous locking call on the same thread.
- See also
lockMutex,tryLockMutex
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_UnlockMutex. The unsafe flavor isunlockMutex. - C declaration
SDL_UnlockMutex, defined atSDL3/SDL_mutex.h 391:34
Since: 3.2.0
Destroy a mutex created with .createMutex
This function must be called on any mutex that is no longer needed. Failure to destroy a mutex will result in a system memory or resource leak. While it is safe to destroy a mutex that is unlocked, it is not safe to attempt to destroy a locked mutex, and may result in undefined behavior depending on the platform.
- Thread safety
- It is safe to call this function from any thread.
- See also
createMutex
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_DestroyMutex. The safe flavor isdestroyMutexSafe. - C declaration
SDL_DestroyMutex, defined atSDL3/SDL_mutex.h 410:34
Since: 3.2.0
Destroy a mutex created with .createMutex
This function must be called on any mutex that is no longer needed. Failure to destroy a mutex will result in a system memory or resource leak. While it is safe to destroy a mutex that is unlocked, it is not safe to attempt to destroy a locked mutex, and may result in undefined behavior depending on the platform.
- Thread safety
- It is safe to call this function from any thread.
- See also
createMutex
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_DestroyMutex. The unsafe flavor isdestroyMutex. - C declaration
SDL_DestroyMutex, defined atSDL3/SDL_mutex.h 410:34
Since: 3.2.0
createRWLock :: IO (Ptr SDL_RWLock) Source #
Create a new read/write lock.
A read/write lock is useful for situations where you have multiple threads trying to access a resource that is rarely updated. All threads requesting a read-only lock will be allowed to run in parallel; if a thread requests a write lock, it will be provided exclusive access. This makes it safe for multiple threads to use a resource at the same time if they promise not to change it, and when it has to be changed, the rwlock will serve as a gateway to make sure those changes can be made safely.
In the right situation, a rwlock can be more efficient than a mutex, which only lets a single thread proceed at a time, even if it won't be modifying the data.
All newly-created read/write locks begin in the unlocked state.
Calls to and lockRWLockForReadinglockRWLockForWriting will not return while the rwlock is locked for writing by another thread. See and tryLockRWLockForReading to attempt to lock without blocking.tryLockRWLockForWriting
SDL read/write locks are only recursive for read-only locks! They are not guaranteed to be fair, or provide access in a FIFO manner! They are not guaranteed to favor writers. You may not lock a rwlock for both read-only and write access at the same time from the same thread (so you can't promote your read-only lock to a write lock without unlocking first).
- Returns
- the initialized and unlocked read/write lock or NULL on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
destroyRWLock,lockRWLockForReading,lockRWLockForWriting,tryLockRWLockForReading,tryLockRWLockForWriting,unlockRWLock
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_CreateRWLock. The safe flavor iscreateRWLockSafe. - C declaration
SDL_CreateRWLock, defined atSDL3/SDL_mutex.h 482:42
Since: 3.2.0
createRWLockSafe :: IO (Ptr SDL_RWLock) Source #
Create a new read/write lock.
A read/write lock is useful for situations where you have multiple threads trying to access a resource that is rarely updated. All threads requesting a read-only lock will be allowed to run in parallel; if a thread requests a write lock, it will be provided exclusive access. This makes it safe for multiple threads to use a resource at the same time if they promise not to change it, and when it has to be changed, the rwlock will serve as a gateway to make sure those changes can be made safely.
In the right situation, a rwlock can be more efficient than a mutex, which only lets a single thread proceed at a time, even if it won't be modifying the data.
All newly-created read/write locks begin in the unlocked state.
Calls to and lockRWLockForReadinglockRWLockForWriting will not return while the rwlock is locked for writing by another thread. See and tryLockRWLockForReading to attempt to lock without blocking.tryLockRWLockForWriting
SDL read/write locks are only recursive for read-only locks! They are not guaranteed to be fair, or provide access in a FIFO manner! They are not guaranteed to favor writers. You may not lock a rwlock for both read-only and write access at the same time from the same thread (so you can't promote your read-only lock to a write lock without unlocking first).
- Returns
- the initialized and unlocked read/write lock or NULL on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
destroyRWLock,lockRWLockForReading,lockRWLockForWriting,tryLockRWLockForReading,tryLockRWLockForWriting,unlockRWLock
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_CreateRWLock. The unsafe flavor iscreateRWLock. - C declaration
SDL_CreateRWLock, defined atSDL3/SDL_mutex.h 482:42
Since: 3.2.0
Arguments
| :: Ptr SDL_RWLock |
|
| -> IO () |
Lock the read/write lock for read only operations.
This will block until the rwlock is available, which is to say it is not locked for writing by any other thread. Of all threads waiting to lock the rwlock, all may do so at the same time as long as they are requesting read-only access; if a thread wants to lock for writing, only one may do so at a time, and no other threads, read-only or not, may hold the lock at the same time.
It is legal for the owning thread to lock an already-locked rwlock for reading. It must unlock it the same number of times before it is actually made available for other threads in the system (this is known as a "recursive rwlock").
Note that locking for writing is not recursive (this is only available to read-only locks).
It is illegal to request a read-only lock from a thread that already holds the write lock. Doing so results in undefined behavior. Unlock the write lock before requesting a read-only lock. (But, of course, if you have the write lock, you don't need further locks to read in any case.)
This function does not fail; if rwlock is NULL, it will return immediately having locked nothing. If the rwlock is valid, this function will always block until it can lock the mutex, and return with it locked.
- Thread safety
- It is safe to call this function from any thread.
- See also
lockRWLockForWriting,tryLockRWLockForReading,unlockRWLock
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_LockRWLockForReading. The safe flavor islockRWLockForReadingSafe: blocks on contention. - C declaration
SDL_LockRWLockForReading, defined atSDL3/SDL_mutex.h 521:34
Since: 3.2.0
lockRWLockForReadingSafe Source #
Arguments
| :: Ptr SDL_RWLock |
|
| -> IO () |
Lock the read/write lock for read only operations.
This will block until the rwlock is available, which is to say it is not locked for writing by any other thread. Of all threads waiting to lock the rwlock, all may do so at the same time as long as they are requesting read-only access; if a thread wants to lock for writing, only one may do so at a time, and no other threads, read-only or not, may hold the lock at the same time.
It is legal for the owning thread to lock an already-locked rwlock for reading. It must unlock it the same number of times before it is actually made available for other threads in the system (this is known as a "recursive rwlock").
Note that locking for writing is not recursive (this is only available to read-only locks).
It is illegal to request a read-only lock from a thread that already holds the write lock. Doing so results in undefined behavior. Unlock the write lock before requesting a read-only lock. (But, of course, if you have the write lock, you don't need further locks to read in any case.)
This function does not fail; if rwlock is NULL, it will return immediately having locked nothing. If the rwlock is valid, this function will always block until it can lock the mutex, and return with it locked.
- Thread safety
- It is safe to call this function from any thread.
- See also
lockRWLockForWriting,tryLockRWLockForReading,unlockRWLock
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_LockRWLockForReading. The unsafe flavor islockRWLockForReading: blocks on contention. - C declaration
SDL_LockRWLockForReading, defined atSDL3/SDL_mutex.h 521:34
Since: 3.2.0
Arguments
| :: Ptr SDL_RWLock |
|
| -> IO () |
Lock the read/write lock for write operations.
This will block until the rwlock is available, which is to say it is not locked for reading or writing by any other thread. Only one thread may hold the lock when it requests write access; all other threads, whether they also want to write or only want read-only access, must wait until the writer thread has released the lock.
It is illegal for the owning thread to lock an already-locked rwlock for writing (read-only may be locked recursively, writing can not). Doing so results in undefined behavior.
It is illegal to request a write lock from a thread that already holds a read-only lock. Doing so results in undefined behavior. Unlock the read-only lock before requesting a write lock.
This function does not fail; if rwlock is NULL, it will return immediately having locked nothing. If the rwlock is valid, this function will always block until it can lock the mutex, and return with it locked.
- Thread safety
- It is safe to call this function from any thread.
- See also
lockRWLockForReading,tryLockRWLockForWriting,unlockRWLock
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_LockRWLockForWriting. The safe flavor islockRWLockForWritingSafe: blocks on contention. - C declaration
SDL_LockRWLockForWriting, defined atSDL3/SDL_mutex.h 554:34
Since: 3.2.0
lockRWLockForWritingSafe Source #
Arguments
| :: Ptr SDL_RWLock |
|
| -> IO () |
Lock the read/write lock for write operations.
This will block until the rwlock is available, which is to say it is not locked for reading or writing by any other thread. Only one thread may hold the lock when it requests write access; all other threads, whether they also want to write or only want read-only access, must wait until the writer thread has released the lock.
It is illegal for the owning thread to lock an already-locked rwlock for writing (read-only may be locked recursively, writing can not). Doing so results in undefined behavior.
It is illegal to request a write lock from a thread that already holds a read-only lock. Doing so results in undefined behavior. Unlock the read-only lock before requesting a write lock.
This function does not fail; if rwlock is NULL, it will return immediately having locked nothing. If the rwlock is valid, this function will always block until it can lock the mutex, and return with it locked.
- Thread safety
- It is safe to call this function from any thread.
- See also
lockRWLockForReading,tryLockRWLockForWriting,unlockRWLock
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_LockRWLockForWriting. The unsafe flavor islockRWLockForWriting: blocks on contention. - C declaration
SDL_LockRWLockForWriting, defined atSDL3/SDL_mutex.h 554:34
Since: 3.2.0
tryLockRWLockForReading Source #
Arguments
| :: Ptr SDL_RWLock |
|
| -> IO Bool |
Try to lock a read/write lock for reading without blocking.
This works just like , but if the rwlock is not available, then this function returns false immediately.lockRWLockForReading
This technique is useful if you need access to a resource but don't want to wait for it, and will return to it to try again later.
Trying to lock for read-only access can succeed if other threads are holding read-only locks, as this won't prevent access.
This function returns true if passed a NULL rwlock.
- Returns
- true on success, false if the lock would block.
- Thread safety
- It is safe to call this function from any thread.
- See also
lockRWLockForReading,tryLockRWLockForWriting,unlockRWLock
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_TryLockRWLockForReading. The safe flavor istryLockRWLockForReadingSafe. - 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_TryLockRWLockForReading, defined atSDL3/SDL_mutex.h 581:34
Since: 3.2.0
tryLockRWLockForReadingSafe Source #
Arguments
| :: Ptr SDL_RWLock |
|
| -> IO Bool |
Try to lock a read/write lock for reading without blocking.
This works just like , but if the rwlock is not available, then this function returns false immediately.lockRWLockForReading
This technique is useful if you need access to a resource but don't want to wait for it, and will return to it to try again later.
Trying to lock for read-only access can succeed if other threads are holding read-only locks, as this won't prevent access.
This function returns true if passed a NULL rwlock.
- Returns
- true on success, false if the lock would block.
- Thread safety
- It is safe to call this function from any thread.
- See also
lockRWLockForReading,tryLockRWLockForWriting,unlockRWLock
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_TryLockRWLockForReading. The unsafe flavor istryLockRWLockForReading. - 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_TryLockRWLockForReading, defined atSDL3/SDL_mutex.h 581:34
Since: 3.2.0
tryLockRWLockForWriting Source #
Arguments
| :: Ptr SDL_RWLock |
|
| -> IO Bool |
Try to lock a read/write lock for writing without blocking.
This works just like , but if the rwlock is not available, then this function returns false immediately.lockRWLockForWriting
This technique is useful if you need exclusive access to a resource but don't want to wait for it, and will return to it to try again later.
It is illegal for the owning thread to lock an already-locked rwlock for writing (read-only may be locked recursively, writing can not). Doing so results in undefined behavior.
It is illegal to request a write lock from a thread that already holds a read-only lock. Doing so results in undefined behavior. Unlock the read-only lock before requesting a write lock.
This function returns true if passed a NULL rwlock.
- Returns
- true on success, false if the lock would block.
- Thread safety
- It is safe to call this function from any thread.
- See also
lockRWLockForWriting,tryLockRWLockForReading,unlockRWLock
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_TryLockRWLockForWriting. The safe flavor istryLockRWLockForWritingSafe. - 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_TryLockRWLockForWriting, defined atSDL3/SDL_mutex.h 613:34
Since: 3.2.0
tryLockRWLockForWritingSafe Source #
Arguments
| :: Ptr SDL_RWLock |
|
| -> IO Bool |
Try to lock a read/write lock for writing without blocking.
This works just like , but if the rwlock is not available, then this function returns false immediately.lockRWLockForWriting
This technique is useful if you need exclusive access to a resource but don't want to wait for it, and will return to it to try again later.
It is illegal for the owning thread to lock an already-locked rwlock for writing (read-only may be locked recursively, writing can not). Doing so results in undefined behavior.
It is illegal to request a write lock from a thread that already holds a read-only lock. Doing so results in undefined behavior. Unlock the read-only lock before requesting a write lock.
This function returns true if passed a NULL rwlock.
- Returns
- true on success, false if the lock would block.
- Thread safety
- It is safe to call this function from any thread.
- See also
lockRWLockForWriting,tryLockRWLockForReading,unlockRWLock
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_TryLockRWLockForWriting. The unsafe flavor istryLockRWLockForWriting. - 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_TryLockRWLockForWriting, defined atSDL3/SDL_mutex.h 613:34
Since: 3.2.0
Arguments
| :: Ptr SDL_RWLock |
|
| -> IO () |
Unlock the read/write lock.
Use this function to unlock the rwlock, whether it was locked for read-only or write operations.
It is legal for the owning thread to lock an already-locked read-only lock. It must unlock it the same number of times before it is actually made available for other threads in the system (this is known as a "recursive rwlock").
It is illegal to unlock a rwlock that has not been locked by the current thread, and doing so results in undefined behavior.
- Thread safety
- This call must be paired with a previous locking call on the same thread.
- See also
lockRWLockForReading,lockRWLockForWriting,tryLockRWLockForReading,tryLockRWLockForWriting
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_UnlockRWLock. The safe flavor isunlockRWLockSafe. - C declaration
SDL_UnlockRWLock, defined atSDL3/SDL_mutex.h 641:34
Since: 3.2.0
Arguments
| :: Ptr SDL_RWLock |
|
| -> IO () |
Unlock the read/write lock.
Use this function to unlock the rwlock, whether it was locked for read-only or write operations.
It is legal for the owning thread to lock an already-locked read-only lock. It must unlock it the same number of times before it is actually made available for other threads in the system (this is known as a "recursive rwlock").
It is illegal to unlock a rwlock that has not been locked by the current thread, and doing so results in undefined behavior.
- Thread safety
- This call must be paired with a previous locking call on the same thread.
- See also
lockRWLockForReading,lockRWLockForWriting,tryLockRWLockForReading,tryLockRWLockForWriting
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_UnlockRWLock. The unsafe flavor isunlockRWLock. - C declaration
SDL_UnlockRWLock, defined atSDL3/SDL_mutex.h 641:34
Since: 3.2.0
Arguments
| :: Ptr SDL_RWLock |
|
| -> IO () |
Destroy a read/write lock created with .createRWLock
This function must be called on any read/write lock that is no longer needed. Failure to destroy a rwlock will result in a system memory or resource leak. While it is safe to destroy a rwlock that is unlocked, it is not safe to attempt to destroy a locked rwlock, and may result in undefined behavior depending on the platform.
- Thread safety
- It is safe to call this function from any thread.
- See also
createRWLock
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_DestroyRWLock. The safe flavor isdestroyRWLockSafe. - C declaration
SDL_DestroyRWLock, defined atSDL3/SDL_mutex.h 660:34
Since: 3.2.0
Arguments
| :: Ptr SDL_RWLock |
|
| -> IO () |
Destroy a read/write lock created with .createRWLock
This function must be called on any read/write lock that is no longer needed. Failure to destroy a rwlock will result in a system memory or resource leak. While it is safe to destroy a rwlock that is unlocked, it is not safe to attempt to destroy a locked rwlock, and may result in undefined behavior depending on the platform.
- Thread safety
- It is safe to call this function from any thread.
- See also
createRWLock
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_DestroyRWLock. The unsafe flavor isdestroyRWLock. - C declaration
SDL_DestroyRWLock, defined atSDL3/SDL_mutex.h 660:34
Since: 3.2.0
Arguments
| :: Word32 |
|
| -> IO (Ptr SDL_Semaphore) |
Create a semaphore.
This function creates a new semaphore and initializes it with the value initial_value. Each wait operation on the semaphore will atomically decrement the semaphore value and potentially block if the semaphore value is 0. Each post operation will atomically increment the semaphore value and wake waiting threads and allow them to retry the wait operation.
- Returns
- a new semaphore or NULL on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
destroySemaphore,signalSemaphore,tryWaitSemaphore,getSemaphoreValue,waitSemaphore,waitSemaphoreTimeout
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_CreateSemaphore. The safe flavor iscreateSemaphoreSafe. - 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_CreateSemaphore, defined atSDL3/SDL_mutex.h 710:45
Since: 3.2.0
Arguments
| :: Word32 |
|
| -> IO (Ptr SDL_Semaphore) |
Create a semaphore.
This function creates a new semaphore and initializes it with the value initial_value. Each wait operation on the semaphore will atomically decrement the semaphore value and potentially block if the semaphore value is 0. Each post operation will atomically increment the semaphore value and wake waiting threads and allow them to retry the wait operation.
- Returns
- a new semaphore or NULL on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
destroySemaphore,signalSemaphore,tryWaitSemaphore,getSemaphoreValue,waitSemaphore,waitSemaphoreTimeout
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_CreateSemaphore. The unsafe flavor iscreateSemaphore. - 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_CreateSemaphore, defined atSDL3/SDL_mutex.h 710:45
Since: 3.2.0
Arguments
| :: Ptr SDL_Semaphore |
|
| -> IO () |
Destroy a semaphore.
It is not safe to destroy a semaphore if there are threads currently waiting on it.
- Thread safety
- It is safe to call this function from any thread.
- See also
createSemaphore
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_DestroySemaphore. The safe flavor isdestroySemaphoreSafe. - C declaration
SDL_DestroySemaphore, defined atSDL3/SDL_mutex.h 726:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Semaphore |
|
| -> IO () |
Destroy a semaphore.
It is not safe to destroy a semaphore if there are threads currently waiting on it.
- Thread safety
- It is safe to call this function from any thread.
- See also
createSemaphore
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_DestroySemaphore. The unsafe flavor isdestroySemaphore. - C declaration
SDL_DestroySemaphore, defined atSDL3/SDL_mutex.h 726:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Semaphore |
|
| -> IO () |
Wait until a semaphore has a positive value and then decrements it.
This function suspends the calling thread until the semaphore pointed to by sem has a positive value, and then atomically decrement the semaphore value.
This function is the equivalent of calling with a time length of -1.waitSemaphoreTimeout
- Thread safety
- It is safe to call this function from any thread.
- See also
signalSemaphore,tryWaitSemaphore,waitSemaphoreTimeout
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_WaitSemaphore. The safe flavor iswaitSemaphoreSafe: blocks indefinitely. - C declaration
SDL_WaitSemaphore, defined atSDL3/SDL_mutex.h 748:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Semaphore |
|
| -> IO () |
Wait until a semaphore has a positive value and then decrements it.
This function suspends the calling thread until the semaphore pointed to by sem has a positive value, and then atomically decrement the semaphore value.
This function is the equivalent of calling with a time length of -1.waitSemaphoreTimeout
- Thread safety
- It is safe to call this function from any thread.
- See also
signalSemaphore,tryWaitSemaphore,waitSemaphoreTimeout
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_WaitSemaphore. The unsafe flavor iswaitSemaphore: blocks indefinitely. - C declaration
SDL_WaitSemaphore, defined atSDL3/SDL_mutex.h 748:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Semaphore |
|
| -> IO Bool |
See if a semaphore has a positive value and decrement it if it does.
This function checks to see if the semaphore pointed to by sem has a positive value and atomically decrements the semaphore value if it does. If the semaphore doesn't have a positive value, the function immediately returns false.
- Returns
- true if the wait succeeds, false if the wait would block.
- Thread safety
- It is safe to call this function from any thread.
- See also
signalSemaphore,waitSemaphore,waitSemaphoreTimeout
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_TryWaitSemaphore. The safe flavor istryWaitSemaphoreSafe. - 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_TryWaitSemaphore, defined atSDL3/SDL_mutex.h 769:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Semaphore |
|
| -> IO Bool |
See if a semaphore has a positive value and decrement it if it does.
This function checks to see if the semaphore pointed to by sem has a positive value and atomically decrements the semaphore value if it does. If the semaphore doesn't have a positive value, the function immediately returns false.
- Returns
- true if the wait succeeds, false if the wait would block.
- Thread safety
- It is safe to call this function from any thread.
- See also
signalSemaphore,waitSemaphore,waitSemaphoreTimeout
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_TryWaitSemaphore. The unsafe flavor istryWaitSemaphore. - 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_TryWaitSemaphore, defined atSDL3/SDL_mutex.h 769:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Semaphore |
|
| -> Int32 |
|
| -> IO Bool |
Wait until a semaphore has a positive value and then decrements it.
This function suspends the calling thread until either the semaphore pointed to by sem has a positive value or the specified time has elapsed. If the call is successful it will atomically decrement the semaphore value.
- Returns
- true if the wait succeeds or false if the wait times out.
- Thread safety
- It is safe to call this function from any thread.
- See also
signalSemaphore,tryWaitSemaphore,waitSemaphore
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_WaitSemaphoreTimeout. The safe flavor iswaitSemaphoreTimeoutSafe: blocks up to the timeout. - 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_WaitSemaphoreTimeout, defined atSDL3/SDL_mutex.h 791:34
Since: 3.2.0
waitSemaphoreTimeoutSafe Source #
Arguments
| :: Ptr SDL_Semaphore |
|
| -> Int32 |
|
| -> IO Bool |
Wait until a semaphore has a positive value and then decrements it.
This function suspends the calling thread until either the semaphore pointed to by sem has a positive value or the specified time has elapsed. If the call is successful it will atomically decrement the semaphore value.
- Returns
- true if the wait succeeds or false if the wait times out.
- Thread safety
- It is safe to call this function from any thread.
- See also
signalSemaphore,tryWaitSemaphore,waitSemaphore
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_WaitSemaphoreTimeout. The unsafe flavor iswaitSemaphoreTimeout: blocks up to the timeout. - 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_WaitSemaphoreTimeout, defined atSDL3/SDL_mutex.h 791:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Semaphore |
|
| -> IO () |
Atomically increment a semaphore's value and wake waiting threads.
- Thread safety
- It is safe to call this function from any thread.
- See also
tryWaitSemaphore,waitSemaphore,waitSemaphoreTimeout
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_SignalSemaphore. The safe flavor issignalSemaphoreSafe. - C declaration
SDL_SignalSemaphore, defined atSDL3/SDL_mutex.h 806:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Semaphore |
|
| -> IO () |
Atomically increment a semaphore's value and wake waiting threads.
- Thread safety
- It is safe to call this function from any thread.
- See also
tryWaitSemaphore,waitSemaphore,waitSemaphoreTimeout
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_SignalSemaphore. The unsafe flavor issignalSemaphore. - C declaration
SDL_SignalSemaphore, defined atSDL3/SDL_mutex.h 806:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Semaphore |
|
| -> IO Word32 |
Get the current value of a semaphore.
- Returns
- the current value of the semaphore.
- Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetSemaphoreValue. The safe flavor isgetSemaphoreValueSafe. - 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_GetSemaphoreValue, defined atSDL3/SDL_mutex.h 818:36
Since: 3.2.0
getSemaphoreValueSafe Source #
Arguments
| :: Ptr SDL_Semaphore |
|
| -> IO Word32 |
Get the current value of a semaphore.
- Returns
- the current value of the semaphore.
- Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetSemaphoreValue. The unsafe flavor isgetSemaphoreValue. - 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_GetSemaphoreValue, defined atSDL3/SDL_mutex.h 818:36
Since: 3.2.0
createCondition :: IO (Ptr SDL_Condition) Source #
Create a condition variable.
- Returns
- a new condition variable or NULL on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
broadcastCondition,signalCondition,waitCondition,waitConditionTimeout,destroyCondition
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_CreateCondition. The safe flavor iscreateConditionSafe. - C declaration
SDL_CreateCondition, defined atSDL3/SDL_mutex.h 859:45
Since: 3.2.0
createConditionSafe :: IO (Ptr SDL_Condition) Source #
Create a condition variable.
- Returns
- a new condition variable or NULL on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
broadcastCondition,signalCondition,waitCondition,waitConditionTimeout,destroyCondition
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_CreateCondition. The unsafe flavor iscreateCondition. - C declaration
SDL_CreateCondition, defined atSDL3/SDL_mutex.h 859:45
Since: 3.2.0
Arguments
| :: Ptr SDL_Condition |
|
| -> IO () |
Destroy a condition variable.
- Thread safety
- It is safe to call this function from any thread.
- See also
createCondition
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_DestroyCondition. The safe flavor isdestroyConditionSafe. - C declaration
SDL_DestroyCondition, defined atSDL3/SDL_mutex.h 872:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Condition |
|
| -> IO () |
Destroy a condition variable.
- Thread safety
- It is safe to call this function from any thread.
- See also
createCondition
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_DestroyCondition. The unsafe flavor isdestroyCondition. - C declaration
SDL_DestroyCondition, defined atSDL3/SDL_mutex.h 872:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Condition |
|
| -> IO () |
Restart one of the threads that are waiting on the condition variable.
- Thread safety
- It is safe to call this function from any thread.
- See also
broadcastCondition,waitCondition,waitConditionTimeout
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_SignalCondition. The safe flavor issignalConditionSafe. - C declaration
SDL_SignalCondition, defined atSDL3/SDL_mutex.h 887:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Condition |
|
| -> IO () |
Restart one of the threads that are waiting on the condition variable.
- Thread safety
- It is safe to call this function from any thread.
- See also
broadcastCondition,waitCondition,waitConditionTimeout
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_SignalCondition. The unsafe flavor issignalCondition. - C declaration
SDL_SignalCondition, defined atSDL3/SDL_mutex.h 887:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Condition |
|
| -> IO () |
Restart all threads that are waiting on the condition variable.
- Thread safety
- It is safe to call this function from any thread.
- See also
signalCondition,waitCondition,waitConditionTimeout
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_BroadcastCondition. The safe flavor isbroadcastConditionSafe. - C declaration
SDL_BroadcastCondition, defined atSDL3/SDL_mutex.h 902:34
Since: 3.2.0
broadcastConditionSafe Source #
Arguments
| :: Ptr SDL_Condition |
|
| -> IO () |
Restart all threads that are waiting on the condition variable.
- Thread safety
- It is safe to call this function from any thread.
- See also
signalCondition,waitCondition,waitConditionTimeout
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_BroadcastCondition. The unsafe flavor isbroadcastCondition. - C declaration
SDL_BroadcastCondition, defined atSDL3/SDL_mutex.h 902:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Condition |
|
| -> Ptr SDL_Mutex |
|
| -> IO () |
Wait until a condition variable is signaled.
This function unlocks the specified mutex and waits for another thread to call or signalCondition on the condition variable broadcastConditioncond. Once the condition variable is signaled, the mutex is re-locked and the function returns.
The mutex must be locked before calling this function. Locking the mutex recursively (more than once) is not supported and leads to undefined behavior.
This function is the equivalent of calling with a time length of -1.waitConditionTimeout
- Thread safety
- It is safe to call this function from any thread.
- See also
broadcastCondition,signalCondition,waitConditionTimeout
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_WaitCondition. The safe flavor iswaitConditionSafe: blocks indefinitely. - C declaration
SDL_WaitCondition, defined atSDL3/SDL_mutex.h 930:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Condition |
|
| -> Ptr SDL_Mutex |
|
| -> IO () |
Wait until a condition variable is signaled.
This function unlocks the specified mutex and waits for another thread to call or signalCondition on the condition variable broadcastConditioncond. Once the condition variable is signaled, the mutex is re-locked and the function returns.
The mutex must be locked before calling this function. Locking the mutex recursively (more than once) is not supported and leads to undefined behavior.
This function is the equivalent of calling with a time length of -1.waitConditionTimeout
- Thread safety
- It is safe to call this function from any thread.
- See also
broadcastCondition,signalCondition,waitConditionTimeout
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_WaitCondition. The unsafe flavor iswaitCondition: blocks indefinitely. - C declaration
SDL_WaitCondition, defined atSDL3/SDL_mutex.h 930:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Condition |
|
| -> Ptr SDL_Mutex |
|
| -> Int32 |
|
| -> IO Bool |
Wait until a condition variable is signaled or a certain time has passed.
This function unlocks the specified mutex and waits for another thread to call or signalCondition on the condition variable broadcastConditioncond, or for the specified time to elapse. Once the condition variable is signaled or the time elapsed, the mutex is re-locked and the function returns.
The mutex must be locked before calling this function. Locking the mutex recursively (more than once) is not supported and leads to undefined behavior.
- Returns
- true if the condition variable is signaled, false if the condition is not signaled in the allotted time.
- Thread safety
- It is safe to call this function from any thread.
- See also
broadcastCondition,signalCondition,waitCondition
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_WaitConditionTimeout. The safe flavor iswaitConditionTimeoutSafe: blocks up to the timeout. - 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_WaitConditionTimeout, defined atSDL3/SDL_mutex.h 960:34
Since: 3.2.0
waitConditionTimeoutSafe Source #
Arguments
| :: Ptr SDL_Condition |
|
| -> Ptr SDL_Mutex |
|
| -> Int32 |
|
| -> IO Bool |
Wait until a condition variable is signaled or a certain time has passed.
This function unlocks the specified mutex and waits for another thread to call or signalCondition on the condition variable broadcastConditioncond, or for the specified time to elapse. Once the condition variable is signaled or the time elapsed, the mutex is re-locked and the function returns.
The mutex must be locked before calling this function. Locking the mutex recursively (more than once) is not supported and leads to undefined behavior.
- Returns
- true if the condition variable is signaled, false if the condition is not signaled in the allotted time.
- Thread safety
- It is safe to call this function from any thread.
- See also
broadcastCondition,signalCondition,waitCondition
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_WaitConditionTimeout. The unsafe flavor iswaitConditionTimeout: blocks up to the timeout. - 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_WaitConditionTimeout, defined atSDL3/SDL_mutex.h 960:34
Since: 3.2.0
Arguments
| :: Ptr SDL_InitState |
|
| -> IO Bool |
Return whether initialization should be done.
This function checks the passed in state and if initialization should be done, sets the status to SDL_INIT_STATUS_INITIALIZING and returns true. If another thread is already modifying this state, it will wait until that's done before returning.
If this function returns true, the calling code must call to complete the initialization.setInitialized
- Returns
- true if initialization needs to be done, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
setInitialized,shouldQuit
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_ShouldInit. The safe flavor isshouldInitSafe. - 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_ShouldInit, defined atSDL3/SDL_mutex.h 1067:34
Since: 3.2.0
Arguments
| :: Ptr SDL_InitState |
|
| -> IO Bool |
Return whether initialization should be done.
This function checks the passed in state and if initialization should be done, sets the status to SDL_INIT_STATUS_INITIALIZING and returns true. If another thread is already modifying this state, it will wait until that's done before returning.
If this function returns true, the calling code must call to complete the initialization.setInitialized
- Returns
- true if initialization needs to be done, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
setInitialized,shouldQuit
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_ShouldInit. The unsafe flavor isshouldInit. - 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_ShouldInit, defined atSDL3/SDL_mutex.h 1067:34
Since: 3.2.0
Arguments
| :: Ptr SDL_InitState |
|
| -> IO Bool |
Return whether cleanup should be done.
This function checks the passed in state and if cleanup should be done, sets the status to SDL_INIT_STATUS_UNINITIALIZING and returns true.
If this function returns true, the calling code must call to complete the cleanup.setInitialized
- Returns
- true if cleanup needs to be done, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
setInitialized,shouldInit
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_ShouldQuit. The safe flavor isshouldQuitSafe. - 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_ShouldQuit, defined atSDL3/SDL_mutex.h 1088:34
Since: 3.2.0
Arguments
| :: Ptr SDL_InitState |
|
| -> IO Bool |
Return whether cleanup should be done.
This function checks the passed in state and if cleanup should be done, sets the status to SDL_INIT_STATUS_UNINITIALIZING and returns true.
If this function returns true, the calling code must call to complete the cleanup.setInitialized
- Returns
- true if cleanup needs to be done, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
setInitialized,shouldInit
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_ShouldQuit. The unsafe flavor isshouldQuit. - 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_ShouldQuit, defined atSDL3/SDL_mutex.h 1088:34
Since: 3.2.0
Arguments
| :: Ptr SDL_InitState |
|
| -> Bool |
|
| -> IO () |
Finish an initialization state transition.
This function sets the status of the passed in state to SDL_INIT_STATUS_INITIALIZED or SDL_INIT_STATUS_UNINITIALIZED and allows any threads waiting for the status to proceed.
- Thread safety
- It is safe to call this function from any thread.
- See also
shouldInit,shouldQuit
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_SetInitialized. The safe flavor issetInitializedSafe. - 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_SetInitialized, defined atSDL3/SDL_mutex.h 1107:34
Since: 3.2.0
Arguments
| :: Ptr SDL_InitState |
|
| -> Bool |
|
| -> IO () |
Finish an initialization state transition.
This function sets the status of the passed in state to SDL_INIT_STATUS_INITIALIZED or SDL_INIT_STATUS_UNINITIALIZED and allows any threads waiting for the status to proceed.
- Thread safety
- It is safe to call this function from any thread.
- See also
shouldInit,shouldQuit
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_SetInitialized. The unsafe flavor issetInitialized. - 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_SetInitialized, defined atSDL3/SDL_mutex.h 1107:34
Since: 3.2.0