summary refs log tree commit diff stats
path: root/tests/parallel/tdisjoint_slice2.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-05-14 23:36:28 +0200
committerAraq <rumpf_a@web.de>2014-05-14 23:36:28 +0200
commit31b8fd66b1bd54b665e52855909538a50d33d7c3 (patch)
treea172909bbd79ae2b8a0e066fe3cd2a90b856d1ee /tests/parallel/tdisjoint_slice2.nim
parentc43e8df90cc5d52c6c57452a28f433075bf66236 (diff)
downloadNim-31b8fd66b1bd54b665e52855909538a50d33d7c3.tar.gz
'parallel' statement: next steps
Diffstat (limited to 'tests/parallel/tdisjoint_slice2.nim')
-rw-r--r--tests/parallel/tdisjoint_slice2.nim21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/parallel/tdisjoint_slice2.nim b/tests/parallel/tdisjoint_slice2.nim
new file mode 100644
index 000000000..b26559fc2
--- /dev/null
+++ b/tests/parallel/tdisjoint_slice2.nim
@@ -0,0 +1,21 @@
+
+import threadpool
+
+proc f(a: openArray[int]) =
+  for x in a: echo x
+
+proc f(a: int) = echo a
+
+proc main() =
+  var a: array[0..30, int]
+  parallel:
+    spawn f(a[0..15])
+    #spawn f(a[16..30])
+    var i = 16
+    while i <= 29:
+      spawn f(a[i])
+      spawn f(a[i+1])
+      inc i, 2
+      # is correct here
+
+main()