Mega Code Archive

 
Categories / 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