mirror of
https://github.com/resiprocate/resiprocate.git
synced 2026-01-12 00:05:02 +08:00
C++20 deprecates operations other than reads and writes performed on volatile variables. Compilers generate warnings about this. In the Log class, touchCount was marked as volatile in attempt to emulate atomics in C++03 (which was incorrect; atomicity was not guaranteed). Replace it with std::atomic. Also change it to unsigned int to increase chances of native support for atomic operations rather than emulation. In testRandomThread, the volatile variables need not be marked as such as the compiler is required to reload these variables across wait() calls since a wait call unlocks and locks the mutex, which implies release and acquire fences.