# File lib/eventmachine.rb, line 861 861: def self::defer op, callback = nil 862: @need_threadqueue ||= 0 863: if @need_threadqueue == 0 864: @need_threadqueue = 1 865: require 'thread' 866: @threadqueue = Queue.new 867: @resultqueue = Queue.new 868: 20.times {|ix| 869: Thread.new { 870: my_ix = ix 871: loop { 872: op,cback = @threadqueue.pop 873: result = op.call 874: @resultqueue << [result, cback] 875: EventMachine.signal_loopbreak 876: } 877: } 878: } 879: end 880: 881: @threadqueue << [op,callback] 882: end