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

WorkerThreadPool (plus friends): Overhaul unlock allowance zones

This fixes a rare but possible deadlock, maybe due to undefined behavior. The new implementation is safer, at the cost of some added boilerplate.

(cherry picked from commit f4d76853b9)
This commit is contained in:
Pedro J. Estébanez
2024-07-18 14:54:58 +02:00
parent b3e46a913d
commit c75c50ecac
12 changed files with 118 additions and 110 deletions

View File

@@ -34,7 +34,7 @@
#include "gdscript.h"
#include "core/object/ref_counted.h"
#include "core/os/mutex.h"
#include "core/os/safe_binary_mutex.h"
#include "core/templates/hash_map.h"
#include "core/templates/hash_set.h"
@@ -95,7 +95,12 @@ class GDScriptCache {
bool cleared = false;
Mutex mutex;
public:
static const int BINARY_MUTEX_TAG = 2;
private:
static SafeBinaryMutex<BINARY_MUTEX_TAG> mutex;
friend SafeBinaryMutex<BINARY_MUTEX_TAG> &_get_gdscript_cache_mutex();
public:
static void move_script(const String &p_from, const String &p_to);