-
Notifications
You must be signed in to change notification settings - Fork 32
add interruptible stdin hint to docs #377
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
add interruptible stdin hint to docs #377
Conversation
| 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a link on how to do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
meaning how to use jline3 or how it uses raw mode with O_NONBLOCKING or VTIME=1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a link to JLine 3 - maybe an appropriate docs page, or anything that would help people use it in a project
|
@adamw done |
|
Thanks! :) |
No description provided.