summaryrefslogtreecommitdiffstats
path: root/core/object/worker_thread_pool.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-06-14 17:13:38 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-06-14 17:13:38 +0200
commit087ef4b94278e8b93c6adf79ed5c376c84dee463 (patch)
treec5d7ab3ae5fb14621be030cfc94214d99ecc2f59 /core/object/worker_thread_pool.cpp
parentc58c50831b8b19a9e276c88c91a47f6b2ee6001a (diff)
parentcc6f5d1a7a2aca1c259a279b7c263b644e970e21 (diff)
downloadredot-engine-087ef4b94278e8b93c6adf79ed5c376c84dee463.tar.gz
Merge pull request #93124 from RandomShaper/skull_trio
`ResourceLoader`: Let the caller thread use its own message queue override
Diffstat (limited to 'core/object/worker_thread_pool.cpp')
-rw-r--r--core/object/worker_thread_pool.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/object/worker_thread_pool.cpp b/core/object/worker_thread_pool.cpp
index 9c9e0fa899..a7c0a0353e 100644
--- a/core/object/worker_thread_pool.cpp
+++ b/core/object/worker_thread_pool.cpp
@@ -53,7 +53,9 @@ void WorkerThreadPool::_process_task(Task *p_task) {
int pool_thread_index = thread_ids[Thread::get_caller_id()];
ThreadData &curr_thread = threads[pool_thread_index];
Task *prev_task = nullptr; // In case this is recursively called.
+
bool safe_for_nodes_backup = is_current_thread_safe_for_nodes();
+ CallQueue *call_queue_backup = MessageQueue::get_singleton() != MessageQueue::get_main_singleton() ? MessageQueue::get_singleton() : nullptr;
{
// Tasks must start with this unset. They are free to set-and-forget otherwise.
@@ -169,6 +171,7 @@ void WorkerThreadPool::_process_task(Task *p_task) {
}
set_current_thread_safe_for_nodes(safe_for_nodes_backup);
+ MessageQueue::set_thread_singleton_override(call_queue_backup);
#endif
}