We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5442

Summary: [PATCH] Optimize and fix spinlock behavior for Windows on ARM
Product: SDL Reporter: Cameron Gutman <cameron.gutman>
Component: atomicAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: ARM   
OS: Windows 10   
Attachments: Patch

Description Cameron Gutman 2021-01-03 18:24:54 UTC
The current implementation of SDL_AtomicUnlock() is not safe for Windows on ARM because it only enforces a compiler memory barrier before unlocking, rather than a real hardware memory barrier.

There's also a little optimization opportunity in SDL_AtomicTryLock() too, since using the InterlockExchange variant with acquire semantics is faster on ARM since it avoids generating a 'dmb' instruction.
Comment 1 Cameron Gutman 2021-01-03 18:25:36 UTC
Created attachment 4635 [details]
Patch
Comment 2 Sam Lantinga 2021-01-03 18:36:22 UTC
Patch added, thanks!
https://hg.libsdl.org/SDL/rev/1cfb48c58bbd