mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-29 04:21:03 +08:00
atomic: Fix infinite recursion in SDL_CompilerBarrier() fallback
On some platforms, SDL_MemoryBarrierRelease() is defined to
SDL_CompilerBarrier(). If SDL_CompilerBarrier() is also defined to
the fallback spinlock acquire/release, then we will infinitely
recurse in SDL_UnlockSpinlock(). Avoid this by not unlocking the
temporary spinlock we create.
(cherry picked from commit d07d39b0da)
This commit is contained in:
@@ -148,8 +148,9 @@ void _ReadWriteBarrier(void);
|
|||||||
extern __inline void SDL_CompilerBarrier(void);
|
extern __inline void SDL_CompilerBarrier(void);
|
||||||
#pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];
|
#pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];
|
||||||
#else
|
#else
|
||||||
|
/* We don't unlock here to avoid possible infinite recursion */
|
||||||
#define SDL_CompilerBarrier() \
|
#define SDL_CompilerBarrier() \
|
||||||
{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
|
{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user