xcorp::When it rains, it pours.

"The nice thing about rain," said Eeyore, "is that it always stops. Eventually."

Thread

やってはいけないことを堂々とやっていたので、慌ててコッソリ修正(;´ー`)y-~~

今までよく動いていたもんだ…リファレンスにもデカデカと載ってるしナ

threads = []
array.each { |item|
  threads.push(Thread.new{
    methodTakesLongTime(item)
  })
}
thread.each { |t| t.join }

ちなみに、リファレンスによると正解は、

threads = []
array.each { |item|
  threads.push(Thread.new(item){ |i|
    methodTakesLongTime(i)
  })
}
thread.each { |t| t.join }

らしいです。なんでも、Thread 内の methodTakesLongTime に渡す際に item が意図しない値(array 内の次以降の要素の値)になることがあるそうです。言われてみて納得w