Godot Version
4.4 stable
Question
As part of the save loading system for my game Fortifend, I’m calling change_scene_to_file() on the SceneTree to initialize a freshly loaded map (before injecting saved game state data). Several pathfinding worker threads are part of the map scene, manged by mutexes and semaphores also in that scene.
How worried should I be about closing these worker threads “properly” in the old scene? I get an ominous warning, but I don’t know if it really matters:
W 0:00:44:231 ~Thread: A Thread object is being destroyed without its completion having been realized.
Please call wait_to_finish() on it to ensure correct cleanup.
W 0:00:44:231 ~Semaphore: A Semaphore object is being destroyed while one or more threads are still waiting on it.
Please call post() on it as necessary to prevent such a situation and so ensure correct cleanup.
Because my pathfinding is a performance critical “tight loop” component, I’m wary about checking a shutdown flag variable every step to see if the thread should exit.