atomic: Fix and cleanup SDL_UnlockSpinlock()

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

(cherry picked from commit 3ebdcc5b1c)
This commit is contained in:
Cameron Gutman
2026-04-27 19:48:53 -05:00
parent 7b377a54b9
commit c32082c94a

View File

@@ -192,20 +192,13 @@ void SDL_AtomicUnlock(SDL_SpinLock *lock)
#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC))
_InterlockedExchange_rel(lock, 0);
#elif defined(_MSC_VER)
_ReadWriteBarrier();
*lock = 0;
#elif defined(__WATCOMC__) && defined(__386__)
SDL_CompilerBarrier();
*lock = 0;
#elif defined(__SOLARIS__)
/* Used for Solaris when not using gcc. */
*lock = 0;
membar_producer();
*lock = 0;
#else
SDL_MemoryBarrierRelease();
*lock = 0;
#endif
}