We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6a355a4 commit c86fdfaCopy full SHA for c86fdfa
tests/notnil/tnotnil5.nim
@@ -0,0 +1,28 @@
1
+discard """
2
+ matrix: "--threads:on"
3
+"""
4
+
5
+{.experimental: "parallel".}
6
+{.experimental: "notnil".}
7
+import threadpool
8
9
+type
10
+ AO = object
11
+ x: int
12
13
+ A = ref AO not nil
14
15
+proc process(a: A): A =
16
+ return A(x: a.x+1)
17
18
+proc processMany(ayys: openArray[A]): seq[A] =
19
+ var newAs: seq[FlowVar[A]]
20
21
+ parallel:
22
+ for a in ayys:
23
+ newAs.add(spawn process(a))
24
+ for newAflow in newAs:
25
+ let newA = ^newAflow
26
+ if isNil(newA):
27
+ return @[]
28
+ result.add(newA)
0 commit comments