sdlTryLockMutex function
Try to lock a mutex without blocking.
This works just like SDL_LockMutex(), but if the mutex is not available, this function returns false immediately.
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.
\param mutex the mutex to try to lock. \returns true on success, false if the mutex would block.
\since This function is available since SDL 3.1.3.
\sa SDL_LockMutex \sa SDL_UnlockMutex
extern SDL_DECLSPEC bool SDLCALL SDL_TryLockMutex(SDL_Mutex *mutex) SDL_TRY_ACQUIRE(0, mutex)
Implementation
bool sdlTryLockMutex(Pointer<NativeType> arg0, Pointer<NativeType> arg1) {
final sdlTryLockMutexLookupFunction = libSdl3.lookupFunction<
Uint8 Function(Pointer<NativeType> arg0, Pointer<NativeType> arg1),
int Function(Pointer<NativeType> arg0,
Pointer<NativeType> arg1)>('SDL_TryLockMutex');
return sdlTryLockMutexLookupFunction(arg0, arg1) == 1;
}