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
We need to ship a game on >=3.3 and be able to set the stack size at thread creation. We need to use the native platform API for creating threads instead of std::thread
Describe the problem or limitation you are having in your project
Since 3.3, Godot doesn't let each platform set their own Thread implementation. We need to do this, as std::thread doesn't let you set a stack size for the thread. We need to increase the stack size on threads and thus we want to use the native API for creating threads.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Let each platform easily set their own Thread implementation, without using std::thread
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Make thread.h more extensible like it was before 3.3
If this enhancement will not be used often, can it be worked around with a few lines of script?
No. The only solution right now is to compile a different thread.cpp instead of the core one, and add #ifdef every time thread.h is included in the engine.
Is there a reason why this should be core and not an add-on in the asset library?
This is about making Godot extensible and easily workable on any platform.
The text was updated successfully, but these errors were encountered:
To add more detail, this is for a console, where the thread stack size can be configured, and the std implementation is crashing with insufficient stack size (this could be a more general godot issue, maybe some code could be optimized to use less stack?). We used to be able to re-implement the thread for the platform, but since the new version of the Thread class that uses the std implementation, we can't. This was fine as first, since the platform has std::thread and friends (in fact we're using the std::mutex and the others), but now we run into this issue. I think it's crucial to allow a platform specific implementation for all the threading classes, even if we think it won't be necessary, this kind of thing still happens, it just makes the engine portable.
Calinou
changed the title
Let platforms set their own Thread implementation
Let platforms set their own Thread implementation again (support was removed in 3.3)
Sep 15, 2021
Describe the project you are working on
We need to ship a game on
>=3.3
and be able to set the stack size at thread creation. We need to use the native platform API for creating threads instead ofstd::thread
Describe the problem or limitation you are having in your project
Since
3.3
, Godot doesn't let each platform set their own Thread implementation. We need to do this, asstd::thread
doesn't let you set a stack size for the thread. We need to increase the stack size on threads and thus we want to use the native API for creating threads.Describe the feature / enhancement and how it helps to overcome the problem or limitation
Let each platform easily set their own Thread implementation, without using
std::thread
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Make
thread.h
more extensible like it was before 3.3If this enhancement will not be used often, can it be worked around with a few lines of script?
No. The only solution right now is to compile a different
thread.cpp
instead of the core one, and add#ifdef
every timethread.h
is included in the engine.Is there a reason why this should be core and not an add-on in the asset library?
This is about making Godot extensible and easily workable on any platform.
The text was updated successfully, but these errors were encountered: