You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thanks a lot for peach, i think it's a great way to parallelize things, but there's a bug when the number of elements to be looped is less than 2*threads:
#!/usr/bin/env ruby
require 'peach'
@max_threads=10
@elements=19
exports = Array.new
puts "start"
$i = 0;
$num = @elements;
while $i < $num do
exports.push($i)
$i +=1;
end
puts "array initialized"
def do_export(num)
print " |export #{num} "
%x(sleep 5)
end
puts "max_threads: #{@max_threads}"
exports.peach(@max_threads) do |export|
do_export(export)
end
this code will execute 19 threads instead of 10.
The text was updated successfully, but these errors were encountered:
hi!
thanks a lot for peach, i think it's a great way to parallelize things, but there's a bug when the number of elements to be looped is less than 2*threads:
this code will execute 19 threads instead of 10.
The text was updated successfully, but these errors were encountered: