Skip to content

IO suspend methods are mixed into FutureController #2

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

Closed
ilya-g opened this issue Jun 23, 2016 · 1 comment
Closed

IO suspend methods are mixed into FutureController #2

ilya-g opened this issue Jun 23, 2016 · 1 comment

Comments

@ilya-g
Copy link
Member

ilya-g commented Jun 23, 2016

Suspension functions for async IO are placed in FutureController due to:

  • async IO must somehow interop with async futures.
  • lack of extension suspend functions
  • even if those extensions were possible, these methods are already member-extensions, so they can't be outside of the controller.

I suggest to wrap async IO operations into CompletableFuture's instead and perform await on these futures. This would require to write:

totalBytesRead += await(input.asyncRead(buf, totalBytesRead))

instead of

totalBytesRead += input.aRead(buf, totalBytesRead)

but IMO it's much more clear that a suspend point is introduced in the first example.

@elizarov
Copy link
Contributor

Not applicable anymore. Async IO can be use in any async coroutine now.

dkhalanskyjb added a commit that referenced this issue Aug 28, 2020
qwwdfsad added a commit that referenced this issue May 10, 2023
To address IDEA's responsiveness issues when reading/writing changelog

Commit #2 -- re-add CHANGES.md
nikitabobko added a commit that referenced this issue Aug 16, 2023
The compilation error appeared after KT-59665
nikitabobko added a commit that referenced this issue Aug 16, 2023
The compilation error appeared after KT-59665
qwwdfsad pushed a commit that referenced this issue Aug 17, 2023
woainikk added a commit that referenced this issue Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants