diff options
author | Araq <rumpf_a@web.de> | 2014-11-10 01:33:25 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-11-10 01:33:25 +0100 |
commit | b6e006fbbe0db7c786e4fb4a3039d544991e380c (patch) | |
tree | a1ed29727d3baeb03da87678a88631ed76e52b1c /tests/parallel | |
parent | 830e0c0009d25d84a26fc997722eee4ecd015fd9 (diff) | |
download | Nim-b6e006fbbe0db7c786e4fb4a3039d544991e380c.tar.gz |
fixes #1646
Diffstat (limited to 'tests/parallel')
-rw-r--r-- | tests/parallel/t5000.nim | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/parallel/t5000.nim b/tests/parallel/t5000.nim new file mode 100644 index 000000000..025c327fa --- /dev/null +++ b/tests/parallel/t5000.nim @@ -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() |