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` 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-01-31 13:34:42 +01:00
parent 6d89f675b1
commit 4485b43a57
54 changed files with 641 additions and 676 deletions

View file

@ -33,6 +33,7 @@
#include "core/command_queue_mt.h"
#include "core/os/thread.h"
#include "core/safe_refcount.h"
#include "servers/visual_server.h"
class VisualServerWrapMT : public VisualServer {
@ -46,12 +47,12 @@ class VisualServerWrapMT : public VisualServer {
void thread_loop();
Thread::ID server_thread;
volatile bool exit;
SafeFlag exit;
Thread thread;
volatile bool draw_thread_up;
SafeFlag draw_thread_up;
bool create_thread;
uint64_t draw_pending;
SafeNumeric<uint64_t> draw_pending;
void thread_draw(bool p_swap_buffers, double frame_step);
void thread_flush();