diff options
author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2024-07-04 10:37:09 +0200 |
---|---|---|
committer | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2024-07-08 10:30:25 +0200 |
commit | f952d3956c60b0c8fdf8d31b997e7f4fe256f6c8 (patch) | |
tree | bda56cb0a3416ae7b23a731b8f53c0457c61e0b5 /core/io/resource_loader.cpp | |
parent | 42e5b3ac2da07d2105c775977b39e6949c723ded (diff) | |
download | redot-engine-f952d3956c60b0c8fdf8d31b997e7f4fe256f6c8.tar.gz |
ResourceLoader: Fixup management of thread-specific status
- Allows the message queue override to flush after loading each resource, which was the original intent.
- Removes a redundant call to mark the thread as safe-for-nodes.
Diffstat (limited to 'core/io/resource_loader.cpp')
-rw-r--r-- | core/io/resource_loader.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 58ad61b621..ab263d9485 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -304,9 +304,10 @@ void ResourceLoader::_thread_load_function(void *p_userdata) { thread_load_mutex.unlock(); // Thread-safe either if it's the current thread or a brand new one. - bool mq_override_present = false; + thread_local bool mq_override_present = false; CallQueue *own_mq_override = nullptr; if (load_nesting == 0) { + mq_override_present = false; load_paths_stack = memnew(Vector<String>); if (!load_task.dependent_path.is_empty()) { @@ -326,10 +327,6 @@ void ResourceLoader::_thread_load_function(void *p_userdata) { } // -- - if (!Thread::is_main_thread()) { - set_current_thread_safe_for_nodes(true); - } - Ref<Resource> res = _load(load_task.remapped_path, load_task.remapped_path != load_task.local_path ? load_task.local_path : String(), load_task.type_hint, load_task.cache_mode, &load_task.error, load_task.use_sub_threads, &load_task.progress); if (mq_override_present) { MessageQueue::get_singleton()->flush(); |