-
-
Save carlzulauf/9c9346f1144d36bcc327 to your computer and use it in GitHub Desktop.
Async example
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
def async | |
t = Thread.new do | |
Thread.stop | |
end | |
yield -> { t.wakeup } | |
t.join | |
end | |
async { |done| puts "foo"; sleep 1; puts "bar"; done.call } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment