1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
require 'action_view/body_parts/future' module ActionView module BodyParts class Threaded < Future def initialize(concurrent = false, &block) super(&block) concurrent ? start : work end protected def start @worker = Thread.new { work } end def finish @worker.join if @worker && @worker.alive? end end end end