Repository navigation
Use portable atomic types for the registry refcount and PC-Talker braille context - #157
Conversation
|
I'm not entirely sure if this would unblock Ubuntu 22.04 (and I'm not even really sure why we would even want to support such old releases of Linux). As for
Hence why I used it. I'm a bit concerned that this may introduce false atomicity (i.e., the STL will convert it into multiple atomic loads or stores or will use locks in place of actual atomics). That said, the value of |
|
Also, is there a reason beyond GCC 12 compat you wanted the registry reference count to be
I'm not necessarily against it, just a bit confused on why that specific change was made. |
|
Thanks for looking at it! It does unblock 22.04: I'm working on integrating Prism into NVGT, and NVGT's CI now compiles it with GCC 12 on Ubuntu 22.04 with this change applied. NVGT builds its Linux releases on 22.04 on purpose, since binaries built against an older glibc run on more distros, so games made with it work for more players. Debian 12 also defaults to GCC 12. On Your point about lock-freedom is fair though, I don't want to lose that guarantee. A few ways I could go:
Which would you prefer? Happy to update the PR whichever way. |
|
I think option 2 might be a good middle ground. And glad to know it unblocks 22.04, I was worried I'd have to do a bunch of C++20 polyfilling or something. Which may still be needed as I hope to take advantage of more C++23 features in future since compilers have sufficiently implemented the standard that it is now a practical and reasonable target. Feel free to give option 2 a try and let's see what breaks. |
std::atomic_unsigned_lock_freeis not available in libstdc++ before GCC 13, so Prism does not compile with GCC 12. GCC 12 is the newest GCC that Ubuntu 22.04 supplies.This change uses
std::atomic<unsigned>for the registry reference count. The PC-Talker backend stores aULONGLONGfromQueryUnbiasedInterruptTimein its braille context. On Windows,std::atomic_unsigned_lock_freeholds anunsigned long, which is 32 bits, so the value was cut short. The braille context now usesstd::atomic<ULONGLONG>.