add interruptible stdin hint to docs#377
Merged
adamw merged 2 commits intosoftwaremill:masterfrom Nov 10, 2025
Merged
Conversation
adamw
reviewed
Nov 3, 2025
| impossible to interrupt such operations directly. This pattern extends to other similar blocking operations that behave | ||
| like stdin. | ||
|
|
||
| The solution is to delegate the blocking operation to a separate thread and use a [channel](../streaming/channels.md) |
Member
There was a problem hiding this comment.
Awesome that you remembered - thanks! :) Maybe it would also be good to mention why the thread needs to be manually created, not Ox-managed (that is, not created through fork)?
adamw
reviewed
Nov 3, 2025
doc/other/best-practices.md
Outdated
| Note that for better stdin performance, you can use `Channel.buffered` instead of a rendezvous channel, or even use | ||
| `java.lang.System.in` directly and proxy raw data through the channel. Keep in mind that this solution leaks a thread | ||
| that will remain blocked on stdin for the lifetime of the application. It's possible to avoid this trade-off by using | ||
| libraries that employ JNI/JNA to access stdin, such as JLine 3, which can use raw mode with non-blocking or |
Contributor
Author
There was a problem hiding this comment.
meaning how to use jline3 or how it uses raw mode with O_NONBLOCKING or VTIME=1?
Member
There was a problem hiding this comment.
just a link to JLine 3 - maybe an appropriate docs page, or anything that would help people use it in a project
Contributor
Author
|
@adamw done |
Member
|
Thanks! :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.