I'm working on getting Rubicon to run to completion under Windows, and
I've come across a possible problem with threading.
threads = []
3.times do |i|
threads << Thread.new(i) do |tno|
1000000.times do |i|
puts("#{tno}: #{i}") if i%100000 == 0
end
end
end
puts "Waiting"
threads.each {|t| t.join}
puts "Done"
Under Linux, the above produces:
0: 0
1: 0
2: 0
Waiting
0: 100000
1: 100000
2: 100000
0: 200000
1: 200000
2: 200000
0: 300000
1: 300000
2: 300000
.....
0: 900000
1: 900000
2: 900000
Done
On my W2K box, with a freshly compiled 1.7.1/Cygwin, I get
0: 0
0: 100000
0: 200000
0: 300000
0: 400000
0: 500000
0: 600000
0: 700000
0: 800000
0: 900000
1: 0
1: 100000
1: 200000
1: 300000
1: 400000
1: 500000
1: 600000
1: 700000
1: 800000
1: 900000
2: 0
2: 100000
2: 200000
2: 300000
2: 400000
2: 500000
2: 600000
2: 700000
2: 800000
2: 900000
Waiting
Done
That is, all threads run to completion: there's no preemption. The
same thing happens with the 1.6.4 from the Installshield distribution.
Dave