diff options
-rw-r--r-- | compiler/semparallel.nim | 4 | ||||
-rw-r--r-- | compiler/sempass2.nim | 2 | ||||
-rw-r--r-- | tests/parallel/tlet_spawn.nim | 14 | ||||
-rw-r--r-- | todo.txt | 7 |
4 files changed, 21 insertions, 6 deletions
diff --git a/compiler/semparallel.nim b/compiler/semparallel.nim index fe735c9f2..c4546f616 100644 --- a/compiler/semparallel.nim +++ b/compiler/semparallel.nim @@ -335,7 +335,7 @@ proc analyse(c: var AnalysisCtx; n: PNode) = localError(n.info, "invalid control flow for 'parallel'") # 'break' that leaves the 'parallel' section is not valid either # or maybe we should generate a 'try' XXX - of nkVarSection: + of nkVarSection, nkLetSection: for it in n: let value = it.lastSon if value.kind != nkEmpty: @@ -396,7 +396,7 @@ proc transformSpawnSons(owner: PSym; n, barrier: PNode): PNode = proc transformSpawn(owner: PSym; n, barrier: PNode): PNode = case n.kind - of nkVarSection: + of nkVarSection, nkLetSection: result = nil for it in n: let b = it.lastSon diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index 43c6f9ccd..a330e0ecd 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -599,7 +599,7 @@ proc track(tracked: PEffects, n: PNode) = addAsgnFact(tracked.guards, n.sons[0], n.sons[1]) notNilCheck(tracked, n.sons[1], n.sons[0].typ) when false: cstringCheck(tracked, n) - of nkVarSection: + of nkVarSection, nkLetSection: for child in n: let last = lastSon(child) if child.kind == nkIdentDefs and last.kind != nkEmpty: diff --git a/tests/parallel/tlet_spawn.nim b/tests/parallel/tlet_spawn.nim new file mode 100644 index 000000000..463ee1a47 --- /dev/null +++ b/tests/parallel/tlet_spawn.nim @@ -0,0 +1,14 @@ + +import threadpool + +proc foo(): int = 999 + +# test that the disjoint checker deals with 'a = spawn f(); g = spawn f()': + +proc main = + parallel: + let f = spawn foo() + let b = spawn foo() + echo "done", f, " ", b + +main() diff --git a/todo.txt b/todo.txt index b62c48d75..70173d50e 100644 --- a/todo.txt +++ b/todo.txt @@ -2,10 +2,12 @@ version 0.10 ============ - Test nimfix on various babel packages -- Pegs do not work at compile-time - deprecate recursive tuples; tuple needs laxer type checking - string case should require an 'else' - # echo type.int +- VM: try does not work at all +- VM: Pegs do not work at compile-time +- VM: ptr/ref T cannot work in general version 0.9.6 ============= @@ -22,7 +24,6 @@ Concurrency generics *when the type is constructed* - test 'deepCopy' -- the disjoint checker needs to deal with 'a = spawn f(); g = spawn f()' - implement 'foo[1..4] = spawn(f[4..7])' - document the new 'spawn' and 'parallel' statements @@ -30,7 +31,7 @@ Low priority: - support for exception propagation? (hard to implement) - the copying of the 'ref Promise' into the thead local storage only happens to work due to the write barrier's implementation -- implement lock levels --> first without the more complex race avoidance +- implement lock levels Misc |