-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
Provide a convenient way to await thread finish. #69796
Provide a convenient way to await thread finish. #69796
Conversation
02d98d8
to
5672e47
Compare
5672e47
to
46b2bd1
Compare
Well......how can I handle this error, I have not develope experience of mono module. |
I think the Also, is this new API really needed? Can't you just await the signal? var thread := Thread.run(do_something_heavy.bind(count))
var result = await thread.finished |
In order to not hurt the origin feature, a way to start async process is needed. Of course, we can avoid to return a signal to deal this problem.
But Signal is type of Godot Variant, for completeness of functionality, we should provide the ability of handle Signal for C#( I don't know the detail of C# in Godot). Even if we limit ourselves avoid this situation, we can't restrict developers to return a Signal. |
We do have support for Signal in the C# bindings generator, but this is the first time it's used and there seems to be an error. That can be easily fixed. It would take a bit more work to turn the C# type into an awaitable. Regarding this new API, since this is the first time it's done this way, we need to decide whether it's the right way. It seems the returned signal acts as a Additionally, it could be great to have a more specific API for this (futures and awaitables), ideally one that would work in C++ as well with |
This fixes the C# bindings: godot/modules/mono/editor/bindings_generator.cpp Line 3654 in 0580790
- itype.c_out = "%5return " C_METHOD_MANAGED_FROM_SIGNAL "(&%1);\n";
+ itype.c_out = "%5return " C_METHOD_MANAGED_FROM_SIGNAL "(in %1);\n"; The C# type needs improvement (rename it from |
a4c4ce6
to
08aac77
Compare
08aac77
to
cf093f8
Compare
Replaced by #70299. |
Implement #5918 and instead of #5893