1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-22 15:06:45 +00:00

Modernize Mutex

- Based on C++11's `mutex`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
- `BinaryMutex` added for special cases as the non-recursive version
- `MutexLock` now takes a reference. At this point the cases of null `Mutex`es are rare. If you ever need that, just don't use `MutexLock`.
- `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same.
This commit is contained in:
Pedro J. Estébanez
2021-01-27 10:43:02 +01:00
parent b450036120
commit 4ddcdc031b
99 changed files with 472 additions and 1391 deletions

View File

@@ -307,16 +307,16 @@ class CSharpLanguage : public ScriptLanguage {
GDMono *gdmono;
SelfList<CSharpScript>::List script_list;
Mutex *script_instances_mutex;
Mutex *script_gchandle_release_mutex;
Mutex *language_bind_mutex;
Mutex script_instances_mutex;
Mutex script_gchandle_release_mutex;
Mutex language_bind_mutex;
Map<Object *, CSharpScriptBinding> script_bindings;
#ifdef DEBUG_ENABLED
// List of unsafe object references
Map<ObjectID, int> unsafe_object_references;
Mutex *unsafe_object_references_lock;
Mutex unsafe_object_references_lock;
#endif
struct StringNameCache {
@@ -358,7 +358,7 @@ class CSharpLanguage : public ScriptLanguage {
public:
StringNameCache string_names;
Mutex *get_language_bind_mutex() { return language_bind_mutex; }
Mutex &get_language_bind_mutex() { return language_bind_mutex; }
_FORCE_INLINE_ int get_language_index() { return lang_idx; }
void set_language_index(int p_idx);