-
-
Save apeiros/c9ad518d2fe35e79ff43 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
module Kernel | |
def future(*args, &block) | |
t = Thread.new(*args, &block) | |
proc { t.value } | |
end | |
module_function :future | |
end | |
f = future { sleep(2); 10 } | |
puts "weee, no block!" | |
puts f.call | |
puts "done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment