Last active
March 28, 2022 07:45
-
-
Save tk3369/ec5449698e2b30d82042f88f9eb2111c to your computer and use it in GitHub Desktop.
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
function stream_user_input(c::Channel) | |
while true | |
line = readline() | |
if line == "" | |
put!(c, ">>bye") | |
break | |
else | |
put!(c, line) | |
end | |
end | |
end | |
function process_inputs(c::Channel) | |
while true | |
line = take!(c) | |
line == ">>bye" && break | |
@info "Received line: $line" | |
end | |
@info "thank you" | |
end | |
function main() | |
c = Channel(5) | |
@async process_inputs(c) | |
stream_user_input(c) | |
end | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment