You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This isn't a problem if an extension uses the Thread class, or if you dont plan to run anything Godot-related in that thread.
However it becomes a problem if anything else needs to be used. WorkedThreadPool for example is pure C++ and does not use Godot objects, therefore it uses std::thread, but lacks the hooks Godot is setting up (while the core implementation uses Thread). This could lead to unforeseen issues related to the absence of this setup.
If threads come from a third party library, there is also no way to set this up, unless said library allows to re-implement its threads using the Thread class. The latter is also a bit inconvenient as it requires the function to run to be a method from a registered Godot object.
Perhaps GDExtension could expose two functions in order to tell Godot when a custom thread starts and ends, so that it can be made aware of them if needed?
The text was updated successfully, but these errors were encountered:
In the Thread class, Godot sets up more things than just running the work function:
https://github.com/godotengine/godot/blob/47ef0549ee490bca066ac00587076f123d973a55/core/os/thread.cpp#L53
Notably, it setups script debugging.
This isn't a problem if an extension uses the
Thread
class, or if you dont plan to run anything Godot-related in that thread.However it becomes a problem if anything else needs to be used. WorkedThreadPool for example is pure C++ and does not use Godot objects, therefore it uses
std::thread
, but lacks the hooks Godot is setting up (while the core implementation usesThread
). This could lead to unforeseen issues related to the absence of this setup.If threads come from a third party library, there is also no way to set this up, unless said library allows to re-implement its threads using the
Thread
class. The latter is also a bit inconvenient as it requires the function to run to be a method from a registered Godot object.Perhaps GDExtension could expose two functions in order to tell Godot when a custom thread starts and ends, so that it can be made aware of them if needed?
The text was updated successfully, but these errors were encountered: