Function SDL_TryWaitSemaphore

pub unsafe extern "C" fn SDL_TryWaitSemaphore(
    sem: *mut SDL_Semaphore,
) -> bool
Available on crate feature dep_sdl3 only.
Expand description

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.

§Parameters

  • sem: the semaphore to wait on.

§Return value

Returns true if the wait succeeds, false if the wait would block.

§Availability

This function is available since SDL 3.2.0.

§See also