Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResourceLoader: Support polling and get-before-complete on the main thread #93695

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

RandomShaper
Copy link
Member

Fixes #92844.

In #92844 it was told that, in reality, polling in a loop in a single frame was never actually supported and that the MRP worked on earlier versions because on them the engine wasn't fully using the freedom such a constraint gave until recently. Therefore, my first idea was to consider the issue a documentation problem.

However, I realized that it was not that hard to support both suboptimal usages (polling in a loop and getting the result before the load completed). And so is that this PR does.

I'm labeling this as enhancement because, again, those usages were never supported and this PR is making them officially supported for the first time. Nonetheless, I'm also warning about them in the docs.

@RandomShaper RandomShaper added this to the 4.3 milestone Jun 28, 2024
@RandomShaper RandomShaper requested review from a team as code owners June 28, 2024 09:23
@RandomShaper RandomShaper changed the title ResourceLoader: Support polling and get-before-complete on the main thead ResourceLoader: Support polling and get-before-complete on the main thread Jun 28, 2024
Copy link
Member

@AThousandShips AThousandShips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code makes sense

// This local poll loop is not needed.
break;
}
thread_load_lock.~MutexLock();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me think a branch I made some time ago to allow unlocking and re-locking of MutexLock is needed, it was just a hypothetical idea then but will revive it and open a PR if it works well still, to avoid potentially hacky solutions

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, but I think this may not be really a good thing to do depending on the kind of mutex now we have #93701. I haven't checked it yet, but I'm suspicious of this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue was something else in the end.

@akien-mga akien-mga merged commit e052a53 into godotengine:master Jun 28, 2024
18 checks passed
@akien-mga
Copy link
Member

Thanks!

@RandomShaper RandomShaper deleted the res_load_main_th branch June 28, 2024 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Regression] LoadThreadedGetStatus stuck in ThreadLoadStatus.InProgress forever
3 participants