Skip to main content

SDL_CreateSemaphore

Function SDL_CreateSemaphore 

Source
pub unsafe extern "C" fn SDL_CreateSemaphore(
    initial_value: Uint32,
) -> *mut SDL_Semaphore
Expand description

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.

Parameter: initial_value the starting value of the semaphore. Returns: a new semaphore or NULL on failure; call SDL_GetError() for more information.

Thread Safety: It is safe to call this function from any thread.

Available Since: This function is available since SDL 3.2.0.

See Also: SDL_DestroySemaphore See Also: SDL_SignalSemaphore See Also: SDL_TryWaitSemaphore See Also: SDL_GetSemaphoreValue See Also: SDL_WaitSemaphore See Also: SDL_WaitSemaphoreTimeout