Function sdl2_sys::SDL_TryLockMutex

source ·
pub unsafe extern "C" fn SDL_TryLockMutex(
    mutex: *mut SDL_mutex
) -> c_int
Expand description

Try to lock a mutex without blocking.

This works just like SDL_LockMutex(), but if the mutex is not available, this function returns SDL_MUTEX_TIMEOUT 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.

\param mutex the mutex to try to lock \returns 0, SDL_MUTEX_TIMEDOUT, or -1 on error; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_CreateMutex \sa SDL_DestroyMutex \sa SDL_LockMutex \sa SDL_UnlockMutex