Get the value returned from a thread : Ruby Threads « Threads « Ruby
- Ruby
- Threads
- Ruby Threads
Get the value returned from a thread
max = 10000
thr = Thread.new do
sum = 0
1.upto(max) { |i| sum += i }
sum
end
puts thr.value
Related examples in the same category