sdlTryLockMutex function mutex
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.2.0.
\sa SDL_LockMutex \sa SDL_UnlockMutex
extern SDL_DECLSPEC bool SDLCALL SDL_TryLockMutex(SDL_Mutex *mutex) SDL_TRY_ACQUIRE(true, mutex)
Implementation
bool sdlTryLockMutex(Pointer<NativeType> arg0, Pointer<NativeType> arg1) {
final sdlTryLockMutexLookupFunction = _libSdl
.lookupFunction<
Uint8 Function(Pointer<NativeType> arg0, Pointer<NativeType> arg1),
int Function(Pointer<NativeType> arg0, Pointer<NativeType> arg1)
>('SDL_TryLockMutex');
return sdlTryLockMutexLookupFunction(arg0, arg1) == 1;
}