Skip to content

Commit

Permalink
ResourceLoader: Let resource setup late steps invoke loading in turn
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomShaper committed Jul 29, 2024
1 parent 88d9325 commit 503e2db
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/io/resource_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,12 @@ void ResourceLoader::_thread_load_function(void *p_userdata) {
MessageQueue::get_singleton()->flush();
}

// We just need to sync with the latest writes. No critical section needed.
// As a good side effect, the mutex is unlocked, which is a requirement if
// some of the calls below to set the resource up invoke code that in turns
// requests resource loading.
thread_load_mutex.lock();
thread_load_mutex.unlock();

load_task.resource = res;

Expand Down Expand Up @@ -389,8 +394,6 @@ void ResourceLoader::_thread_load_function(void *p_userdata) {
}
}

thread_load_mutex.unlock();

if (load_nesting == 0) {
if (own_mq_override) {
MessageQueue::set_thread_singleton_override(nullptr);
Expand Down

0 comments on commit 503e2db

Please sign in to comment.