'parallel' proves array bounds

This commit is contained in:
Araq 2014-05-29 13:27:45 +02:00
commit 6470bd8f87
3 changed files with 107 additions and 14 deletions

View file

@ -0,0 +1,24 @@
discard """
output: '''3
4
5
6
7'''
sortoutput: true
"""
import threadpool, math
proc p(x: int) =
echo x
proc testFor(a, b: int; foo: var openArray[int]) =
parallel:
for i in max(a, 0) .. min(b, foo.len-1):
spawn p(foo[i])
var arr = [0, 1, 2, 3, 4, 5, 6, 7]
testFor(3, 10, arr)