Created
October 19, 2022 13:56
-
-
Save forsaken1/6a578602ea6f930af81dde87313c8089 to your computer and use it in GitHub Desktop.
Async Ractors
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 'before Thread' | |
ractor = Ractor.new do | |
puts 'Thread start' | |
sleep Ractor.receive | |
puts 'Thread end' | |
end | |
puts 'after Thread' | |
ractor.send 5 | |
puts 'after send' # you should see "after send" and "Thread start" immediately | |
sleep 6 | |
puts 'end' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment