mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-28 12:27:24 +02:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user