Method of Array class for simple parallel processing without exclusive control. It is a simple implementation to initiate multiple processes asynchronously.
1) Array::meach(mpcount){|value| block}
2) Array::meach(mpcount){|value,count| block}
Process the code in parallel by block when value is given as the block parameter of an element in an array. If count is given as a block parameter, set the array element number (integer from 0) being processed.
mpcount - Number of parallel processes.
# Process five elements from 10 to 6 (integer) in two parallel threads.
# Processing content is as simple as displaying the value of element and the element
number of the array.
> [10,9,8,7,6].meach(2){|value,count|
> puts "#{value},#{count}"
> }
10,0
9,1
8,2
7,3
6,4