summaryrefslogtreecommitdiff
path: root/modules/gdnative/nativescript/nativescript.h
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2021-02-10 19:22:13 +0100
committerPedro J. Estébanez <pedrojrulez@gmail.com>2021-02-18 17:12:46 +0100
commit8e128726f0eac1982aa75a005554ee5b556b332e (patch)
tree827c2f478e8fb3196ef411f4941fa4e839642e31 /modules/gdnative/nativescript/nativescript.h
parent8870f43d742e0c48ae543d999856f5989170b62d (diff)
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>
Diffstat (limited to 'modules/gdnative/nativescript/nativescript.h')
-rw-r--r--modules/gdnative/nativescript/nativescript.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h
index 81a158d09b..d6ba2bbec1 100644
--- a/modules/gdnative/nativescript/nativescript.h
+++ b/modules/gdnative/nativescript/nativescript.h
@@ -40,6 +40,7 @@
#include "core/os/thread_safe.h"
#include "core/templates/oa_hash_map.h"
#include "core/templates/ordered_hash_map.h"
+#include "core/templates/safe_refcount.h"
#include "core/templates/self_list.h"
#include "scene/main/node.h"
@@ -262,7 +263,7 @@ private:
#ifndef NO_THREADS
Set<Ref<GDNativeLibrary>> libs_to_init;
Set<NativeScript *> scripts_to_register;
- volatile bool has_objects_to_register = false; // so that we don't lock mutex every frame - it's rarely needed
+ SafeFlag has_objects_to_register; // so that we don't lock mutex every frame - it's rarely needed
void defer_init_library(Ref<GDNativeLibrary> lib, NativeScript *script);
#endif