Skip to content

Commit

Permalink
Merge pull request #77724 from RandomShaper/remove_red_th_cond
Browse files Browse the repository at this point in the history
Remove redundant check from thread guards
  • Loading branch information
akien-mga committed Jun 1, 2023
2 parents 42775ff + 8c28891 commit 2e273f0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions scene/main/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -541,19 +541,22 @@ class Node : public Object {
}
_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;
}
}
Expand Down

0 comments on commit 2e273f0

Please sign in to comment.