Skip to content

Instantly share code, notes, and snippets.

@carlzulauf
Last active August 29, 2015 14:27
Show Gist options
  • Save carlzulauf/9c9346f1144d36bcc327 to your computer and use it in GitHub Desktop.
Save carlzulauf/9c9346f1144d36bcc327 to your computer and use it in GitHub Desktop.
Async example
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