x = 0 t1 = Thread.new do 1.upto(1000) do x = x + 1 end end t2 = Thread.new do 1.upto(1000) do x = x + 1 end end t1.join t2.join puts x