[C#] Integrate CancellationToken with ToSignal's AwaitableSignal Creation #7993
PereViader
started this conversation in
Scripting
Replies: 1 comment
-
A workaround for this is to implement the cancellation support manually for each of the Signals as extension methods. A Roslyn source generator could be written to handle this.
The advantadge of doing it in this way is that given a signal that has some parameters, this could expose the parameters in a type safe way
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In the Godot engine, signals provide a mechanism to handle asynchronous scenarios. However, the method doesn't natively support any kind of cancellation. The idiomatic way of doing cancellation in c# is to use CancellationToken. The lack of compatibility of ToSignal with CancellationToken limits the developer's control over cancellation and resource management.
With this, we would align Godot’s async capabilities with common C# asynchronous programming practices, making it familiar and intuitive for C# developers.
Proposed usage
Beta Was this translation helpful? Give feedback.
All reactions