Method: Fork.future
- Defined in:
- lib/fork.rb
.future(*args) ⇒ Proc
A simple forked-future implementation. Will process the block in a fork, blocks upon request of the result until the result is present. If the forked code raises an exception, invoking call on the proc will raise that exception in the parent process.
118 119 120 121 122 123 124 |
# File 'lib/fork.rb', line 118 def self.future(*args) obj = execute :return => true do |parent| yield(*args) end lambda { obj.return_value } end |