Remove redundant check from thread guards

This commit is contained in:
Pedro J. Estébanez 2023-06-01 11:03:32 +02:00
parent c3e512eda4
commit 8c288918a0

View file

@ -541,19 +541,22 @@ public:
}
_FORCE_INLINE_ bool is_accessible_from_caller_thread() const {
if (current_process_thread_group == nullptr) {
// Not thread processing. Only accessible if node is outside the scene tree,
// if accessing from the main thread or being loaded.
// No thread processing.
// Only accessible if node is outside the scene tree
// or access will happen from a node-safe thread.
return !data.inside_tree || is_current_thread_safe_for_nodes();
} else {
// Thread processing
// Thread processing.
return current_process_thread_group == data.process_thread_group_owner;
}
}
_FORCE_INLINE_ bool is_readable_from_caller_thread() const {
if (current_process_thread_group == nullptr) {
return Thread::is_main_thread() || is_current_thread_safe_for_nodes();
// No thread processing.
return is_current_thread_safe_for_nodes();
} else {
// Thread processing.
return true;
}
}