SDL: atomic: Fix and cleanup SDL_UnlockSpinlock() (0013e)

From 0013e9e1d366af3c0dfb4c373a23aa5e3f258192 Mon Sep 17 00:00:00 2001
From: Cameron Gutman <[EMAIL REDACTED]>
Date: Fri, 24 Apr 2026 22:26:28 -0500
Subject: [PATCH] atomic: Fix and cleanup SDL_UnlockSpinlock()

- Add missing SDL_MemoryBarrierRelease() in the generic codepath
- Remove MSVC x86/x64 case which is now identical to the generic codepath
- Fix Solaris barrier to ensure prior stores are visible before unlocking

(cherry picked from commit 95ae0c194ec785d5a7ecf8b83a34f7f2ae29b07a)
---
 src/atomic/SDL_spinlock.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/atomic/SDL_spinlock.c b/src/atomic/SDL_spinlock.c
index 32913b4f7208b..c048866604c33 100644
--- a/src/atomic/SDL_spinlock.c
+++ b/src/atomic/SDL_spinlock.c
@@ -171,16 +171,13 @@ void SDL_UnlockSpinlock(SDL_SpinLock *lock)
     SDL_COMPILE_TIME_ASSERT(locksize, sizeof(*lock) == sizeof(long));
     _InterlockedExchange_rel((long *)lock, 0);
 
-#elif defined(_MSC_VER)
-    _ReadWriteBarrier();
-    *lock = 0;
-
 #elif defined(SDL_PLATFORM_SOLARIS)
     // Used for Solaris when not using gcc.
-    *lock = 0;
     membar_producer();
+    *lock = 0;
 
 #else
+    SDL_MemoryBarrierRelease();
     *lock = 0;
 #endif
 }