Modernize atomics

- Based on C++11's `atomic`
- Reworked `SafeRefCount` (based on the rewrite by @hpvb)
- Replaced free atomic functions by the new `SafeNumeric<T>`
- Replaced wrong cases of `volatile bool` by the new `SafeFlag`
- Platform-specific implementations no longer needed

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
This commit is contained in:
Pedro J. Estébanez 2021-02-10 19:22:13 +01:00
parent 8870f43d74
commit 8e128726f0
58 changed files with 650 additions and 639 deletions

View file

@ -34,6 +34,7 @@
#include "core/typedefs.h"
#if !defined(NO_THREADS)
#include "core/templates/safe_refcount.h"
#include <thread>
#endif
@ -61,7 +62,7 @@ private:
friend class Main;
static ID main_thread_id;
static ID last_thread_id;
static SafeNumeric<Thread::ID> last_thread_id;
ID id = 0;
static thread_local ID caller_id;