sdlTryWaitSemaphore function
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.
\param sem the semaphore to wait on. \returns true if the wait succeeds, false if the wait would block.
\since This function is available since SDL 3.1.3.
\sa SDL_SignalSemaphore \sa SDL_WaitSemaphore \sa SDL_WaitSemaphoreTimeout
extern SDL_DECLSPEC bool SDLCALL SDL_TryWaitSemaphore(SDL_Semaphore *sem)
Implementation
bool sdlTryWaitSemaphore(Pointer<SdlSemaphore> sem) {
final sdlTryWaitSemaphoreLookupFunction = libSdl3.lookupFunction<
Uint8 Function(Pointer<SdlSemaphore> sem),
int Function(Pointer<SdlSemaphore> sem)>('SDL_TryWaitSemaphore');
return sdlTryWaitSemaphoreLookupFunction(sem) == 1;
}