godot
godot copied to clipboard
Add tests for threaded resource loading
For #73647
I've only been able to test the non-threaded sections, so if this fails (which it probably will), it would be due to incorrect usage of ResourceLoader's threading functions.
@RandomShaper Present for you :slightly_smiling_face:
Playing with this plus my #71280 at https://github.com/RandomShaper/godot/tree/fix_deadlock_windows_with_tests.
I've done a mashup of threading fixing and testing PRs. Thread sanitizer seems OK now! https://github.com/RandomShaper/godot/commits/fix_deadlock_windows_with_tests
After 4.0 is released, I guess all these PRs can be merged. They will be good for 4.0.1 and also set a good basis for the threading safety overhaul that will happen on 4.1.
I wrote a unit test to help @RandomShaper with the threaded (or dreaded? 😄) resource loading fixes https://github.com/godotengine/godot/pull/74405#issuecomment-1462137183 Have a look at the code here: https://gist.github.com/mrTag/117ba6737ab9cee789cb4835dc702fe2 maybe it would make sense to include it in this PR? Or maybe your "[Resource] Thread safety test" does something similar? It freezes on my system and I didn't quite get what it wanted to test.