Created
October 6, 2022 11:35
-
-
Save ismasan/f5a82cccd80dffd789cba66f3b56b0e3 to your computer and use it in GitHub Desktop.
This file contains 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
puts "START" | |
chan = Channel(Nil).new | |
spawn do | |
sleep 6 | |
chan.send nil | |
end | |
select | |
when chan.receive | |
puts "CHAN" | |
when timeout(5.seconds) | |
puts "TIMEOUT" | |
end | |
sleep 10 | |
puts "BYE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment