From: Jaeyong Lee Date: 2010-11-17T16:50:41+09:00 Subject: Thread problem Hi all, I learning ruby thread and faced to thread problem. Here's my test code that sum 1 to 1000. -- threads = [] sum = 0 1.upto(1000) { |external| threads << Thread.new(external) { |local| sleep(rand(0.01)) sum = sum + local } } threads.each() { |thread| thread.join() } puts sum -- I expected '500500' but output is smaller than. (ex: 499864) Please let me know what problem is. -- Posted via http://www.ruby-forum.com/.