1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-12 13:20:55 +00:00

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

@@ -34,6 +34,7 @@
#include "core/io/http_client.h"
#include "core/os/file_access.h"
#include "core/os/thread.h"
#include "core/safe_refcount.h"
#include "node.h"
#include "scene/main/timer.h"
@@ -74,7 +75,7 @@ private:
bool request_sent;
Ref<HTTPClient> client;
PoolByteArray body;
volatile bool use_threads;
SafeFlag use_threads;
bool got_response;
int response_code;
@@ -85,7 +86,7 @@ private:
FileAccess *file;
int body_len;
volatile int downloaded;
SafeNumeric<int> downloaded;
int body_size_limit;
int redirections;
@@ -103,8 +104,8 @@ private:
Error _parse_url(const String &p_url);
Error _request();
volatile bool thread_done;
volatile bool thread_request_quit;
SafeFlag thread_done;
SafeFlag thread_request_quit;
Thread thread;