'parallel' statement: next steps
This commit is contained in:
parent
c43e8df90c
commit
31b8fd66b1
7 changed files with 221 additions and 50 deletions
21
tests/parallel/tdisjoint_slice1.nim
Normal file
21
tests/parallel/tdisjoint_slice1.nim
Normal file
|
|
@ -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 = 0
|
||||
while i <= 29:
|
||||
spawn f(a[i])
|
||||
spawn f(a[i+1])
|
||||
inc i, 2
|
||||
# is correct here
|
||||
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue