1
0
Эх сурвалжийг харах

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
Cameron Gutman 1 долоо хоног өмнө
parent
commit
3ebdcc5b1c

+ 2 - 9
src/atomic/SDL_spinlock.c

@@ -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
 }