a = "some text" thr = Array.new 0.upto(10) { |i| thr << Thread.new(i) { |a| b = i sleep 0.1 puts "(a, b, i) = (#{a}, #{b}, #{i})" #$stderr.print "bug!" if a != i } } thr.each { |t| t.join }