This commit is contained in:
Araq 2014-11-10 01:33:25 +01:00
commit b6e006fbbe
5 changed files with 32 additions and 11 deletions

22
tests/parallel/t5000.nim Normal file
View file

@ -0,0 +1,22 @@
discard """
output: '''50005000'''
"""
import threadpool, strutils
proc foo(x: int): string = $x
proc main() =
var a = newSeq[int]()
for i in 1..10000:
add(a, i)
var s = 0
for i in a:
s += parseInt(^spawn(foo(i)))
echo s
setMaxPoolSize 2
parallel:
spawn main()