require 'fastthread' class AsyncFu def initialize(obj = nil) @class = obj || self at_exit{ unless @exit until Thread.list.size == 1 do Thread.pass end end } end def method_missing(name, *args) if @class.respond_to?(name) Thread.new{ @class.send name, *args } else @class.send name, *args end end def exit @exit = true end end