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

Add sleep to user input thread #149

Merged
merged 1 commit into from
May 8, 2018
Merged

Add sleep to user input thread #149

merged 1 commit into from
May 8, 2018

Conversation

eatkins
Copy link
Contributor

@eatkins eatkins commented May 8, 2018

I didn't realize that System.in.read is not interruptible, so it was
problematic* to change the downstream termination condition from:

  • System.in.available > 0 && (watched.terminateWatch(System.in.read()) || shouldTerminate)
  • watched.terminateWatch(System.in.read()) || shouldTerminate

Instead, we should revert to the old termination condition and add a
sleep so that we don't peg the cpu.

  • This would manifest as the user having to hit enter twice to exit the
    watch in some circumstances because the user input thread could not be
    joined.

I didn't realize that System.in.read is not interruptible, so it was
problematic* to change the downstream termination condition from:
-  System.in.available > 0 && (watched.terminateWatch(System.in.read()) || shouldTerminate)
+  watched.terminateWatch(System.in.read()) || shouldTerminate

Instead, we should revert to the old termination condition and add a
sleep so that we don't peg the cpu.

* This would manifest as the user having to hit enter twice to exit the
watch in some circumstances because the user input thread could not be
joined.
@eed3si9n eed3si9n merged commit 6e6e2cb into sbt:1.1.x May 8, 2018
@eed3si9n
Copy link
Member

eed3si9n commented May 8, 2018

ok. A new version of IO coming up.

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

Successfully merging this pull request may close these issues.

2 participants