Skip to content

Commit 3ebdcc5

Browse files
committed
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
1 parent dd1e04e commit 3ebdcc5

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

src/atomic/SDL_spinlock.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,20 +192,13 @@ void SDL_AtomicUnlock(SDL_SpinLock *lock)
192192
#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC))
193193
_InterlockedExchange_rel(lock, 0);
194194

195-
#elif defined(_MSC_VER)
196-
_ReadWriteBarrier();
197-
*lock = 0;
198-
199-
#elif defined(__WATCOMC__) && defined(__386__)
200-
SDL_CompilerBarrier();
201-
*lock = 0;
202-
203195
#elif defined(__SOLARIS__)
204196
/* Used for Solaris when not using gcc. */
205-
*lock = 0;
206197
membar_producer();
198+
*lock = 0;
207199

208200
#else
201+
SDL_MemoryBarrierRelease();
209202
*lock = 0;
210203
#endif
211204
}

0 commit comments

Comments
 (0)