Skip to content
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

Cancellation #72

Open
Aidan63 opened this issue Apr 5, 2024 · 0 comments
Open

Cancellation #72

Aidan63 opened this issue Apr 5, 2024 · 0 comments
Labels

Comments

@Aidan63
Copy link
Owner

Aidan63 commented Apr 5, 2024

There are many asynchronous operations which may never complete for one reason or another (reading from sockets / stdio / anything which could produce data, waiting for process exits, etc, etc) and there are many situations where you may want to attempt some operation up until a certain point at which point it isn't relevant / wanted any more (e.g. having a timeout on reading user input from stdin). You could probably of emulate some of these situations by closing the object whenever your chosen cancellation criteria has been met, but the entire object is then un-usable as oposed to just an operation of your choosing currently being performed or waiting to be performed getting stopped.

Part of the answer to this might also be in the coroutine design, in kotlin you can request the cancellation of a coroutine though a function on the object representing a launched coroutine. So if haxe coroutines end up having something similar that might be one approach for this.
Another approach could be the cancellation token technique used in dotnet, this approach is quite nice in that its completely divorced from from their async / tasks and can also be used in standard synchronous / traditional threading code. I'm also not sure if the eventual plan is for all the haxe asys functions to be manually changed to suspending functions or if there is desire to allow them to be used in their current callback style if the user is mad enough, that choice would also effect what cancellation might look like to the asys api.

@Aidan63 Aidan63 added the design label Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant