mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-28 03:26:15 +08: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
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))
|
#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC))
|
||||||
_InterlockedExchange_rel(lock, 0);
|
_InterlockedExchange_rel(lock, 0);
|
||||||
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
_ReadWriteBarrier();
|
|
||||||
*lock = 0;
|
|
||||||
|
|
||||||
#elif defined(__WATCOMC__) && defined(__386__)
|
|
||||||
SDL_CompilerBarrier();
|
|
||||||
*lock = 0;
|
|
||||||
|
|
||||||
#elif defined(__SOLARIS__)
|
#elif defined(__SOLARIS__)
|
||||||
/* Used for Solaris when not using gcc. */
|
/* Used for Solaris when not using gcc. */
|
||||||
*lock = 0;
|
|
||||||
membar_producer();
|
membar_producer();
|
||||||
|
*lock = 0;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
SDL_MemoryBarrierRelease();
|
||||||
*lock = 0;
|
*lock = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user