SDL: audio: remove is_in_audio_device_thread()

From 81fe505c31718b96fd265c653bbae882640ee6ca Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Wed, 24 May 2023 13:34:28 -0400
Subject: [PATCH] audio: remove is_in_audio_device_thread()

SDL mutexes are always recursive in modern times, so no need to check this,
plus the test triggers a false-positive on ThreadSanitizer.

Reference Issue #7427.
---
 src/audio/SDL_audio.c | 25 ++++---------------------
 1 file changed, 4 insertions(+), 21 deletions(-)

diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index 09abb24cf918..80f65588688c 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -182,31 +182,14 @@ static int SDL_AudioOpenDevice_Default(SDL_AudioDevice *_this, const char *devna
     return SDL_Unsupported();
 }
 
-static SDL_INLINE SDL_bool is_in_audio_device_thread(SDL_AudioDevice *device)
+static void SDL_AudioLockDevice_Default(SDL_AudioDevice *device)
 {
-    /* The device thread locks the same mutex, but not through the public API.
-       This check is in case the application, in the audio callback,
-       tries to lock the thread that we've already locked from the
-       device thread...just in case we only have non-recursive mutexes. */
-    if (device->thread && (SDL_ThreadID() == device->threadid)) {
-        return SDL_TRUE;
-    }
-
-    return SDL_FALSE;
+    SDL_LockMutex(device->mixer_lock);
 }
 
-static void SDL_AudioLockDevice_Default(SDL_AudioDevice *device) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang assumes recursive locks */
+static void SDL_AudioUnlockDevice_Default(SDL_AudioDevice *device)
 {
-    if (!is_in_audio_device_thread(device)) {
-        SDL_LockMutex(device->mixer_lock);
-    }
-}
-
-static void SDL_AudioUnlockDevice_Default(SDL_AudioDevice *device) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang assumes recursive locks */
-{
-    if (!is_in_audio_device_thread(device)) {
-        SDL_UnlockMutex(device->mixer_lock);
-    }
+    SDL_UnlockMutex(device->mixer_lock);
 }
 
 static void finish_audio_entry_points_init(void)