From eadc8f93553b119c32a6e9cd00370a1c29886da8 Mon Sep 17 00:00:00 2001
From: David Gow <[EMAIL REDACTED]>
Date: Sat, 2 Oct 2021 23:08:39 +0800
Subject: [PATCH] wayland: Cleanup some SDL_TryLockMutex() calls.
Check the result of these against 0 explicitly, so that it's obvious
we're bailing out on failure, not success.
---
src/video/wayland/SDL_waylandevents.c | 2 +-
src/video/wayland/SDL_waylandopengles.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c
index 799e5fb9bb..11a4ebdbc7 100644
--- a/src/video/wayland/SDL_waylandevents.c
+++ b/src/video/wayland/SDL_waylandevents.c
@@ -234,7 +234,7 @@ Wayland_PumpEvents(_THIS)
/* If we're trying to dispatch the display in another thread,
* we could trigger a race condition and end up blocking
* in wl_display_dispatch() */
- if (SDL_TryLockMutex(d->display_dispatch_lock)) {
+ if (SDL_TryLockMutex(d->display_dispatch_lock) != 0) {
return;
}
diff --git a/src/video/wayland/SDL_waylandopengles.c b/src/video/wayland/SDL_waylandopengles.c
index a6cb5027fa..959ebc8faf 100644
--- a/src/video/wayland/SDL_waylandopengles.c
+++ b/src/video/wayland/SDL_waylandopengles.c
@@ -151,7 +151,7 @@ Wayland_GLES_SwapWindow(_THIS, SDL_Window *window)
/* Make sure we're not competing with SDL_PumpEvents() for any new
* events, or one of us may end up blocking in wl_display_dispatch */
- if (SDL_TryLockMutex(videodata->display_dispatch_lock)) {
+ if (SDL_TryLockMutex(videodata->display_dispatch_lock) != 0) {
continue;
}