Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Kernel
- def future(&blk)
- raise ArgumentError, "no block supplied" unless blk
- o = BasicObject.new
- class << o
- def __initialize__(thr)
- @thread = thr
- return self
- end
- def method_missing(name, *args, &blk)
- @thread.value.send(name, *args, &blk)
- end
- end
- return o.__initialize__(Thread.start(&blk))
- end
- end
Add Comment
Please, Sign In to add comment