You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then I enter a number at the repl, and printing stops.
If I enter numbers 4 times printing continues, but the interim 3 numbers fall into a black hole, never getting processed.
Enter a 5th number, and printing stops again, until you've entered 4 more numbers.
Each time you get printing to resume, it catch-up-prints dozens of numbers, but they'll all be the most recently input number, many times all instantaneously.
EDIT: I thought it was a flushing issue, but nope, that number never gets processed, as evident in the "catchup" prints. I've even tried passing stdin/out handles throughout and manually flushing, and... no go.
EDIT: Doesn't help to print to stderr, nor to change the buffering status of the handle (hSetBuffering stdin NoBuffering). Probably just spinning my wheels at this point 😅
EDIT: Let me know if you struggle to reproduce it, I can screencast a video.
The text was updated successfully, but these errors were encountered:
This is to be expected, in fact. I ought to document this better. Maybe a FAQ section in the README.md, or what do you think?
The reason is that you have a blocking ClSF, namely input, in the signal network. All purely data-related components should be non-blocking, only clocks are allowed to block. There is no obvious way to prevent blocking IO.
We can simplify your program to make it work. The standard approach to deal with blocking IO is to put it in a clock. In the case of stdin, this has already been done in form of the StdinClock, as you've found out. Since the clock already does the blocking IO, you don't need to do it again with getLine. Instead, you can simply use tagS to retrieve the input line. It should look something like:
I've spent some time boiling this bug (?) down to a simple example:
readLn
(*100)
print
When I run this, it starts printing as expected.
Then I enter a number at the repl, and printing stops.
If I enter numbers 4 times printing continues, but the interim 3 numbers fall into a black hole, never getting processed.
Enter a 5th number, and printing stops again, until you've entered 4 more numbers.
Each time you get printing to resume, it catch-up-prints dozens of numbers, but they'll all be the most recently input number, many times all instantaneously.
EDIT: I thought it was a flushing issue, but nope, that number never gets processed, as evident in the "catchup" prints. I've even tried passing
stdin/out
handles throughout and manually flushing, and... no go.EDIT: Doesn't help to print to
stderr
, nor to change the buffering status of the handle (hSetBuffering stdin NoBuffering
). Probably just spinning my wheels at this point 😅EDIT: Let me know if you struggle to reproduce it, I can screencast a video.
The text was updated successfully, but these errors were encountered: