**OderWat** Great! Maybe **Araq** will want to include in the next build
something like that? :) Personally I would not mind.
Works for me...
# nim c --threads:on -d:release --verbosity:0
{.experimental.}
import times
import threadpool
proc enumerableRepeat[T](value: T, n: int = -1): iterator(): T {.gcsafe.} =
result = iterator(): T {.closure.} =
var i = 0
Thank you very much for your help :)
With the pragma {.closure.} now you can use the external variables in the
template. But when you try to use my previous function (_writeFile_ from this
thread [writeFile with
iterator](http://forum.nim-lang.org///forum.nim-lang.org/t/2403))
pa
You could not use the global GC value of "w" in a thread. So you have to make
that const first of all.
Then going back to "basic" coding. This works:
# nim c --threads:on -d:release
{.experimental.}
import times
import threadpool
const w = ["aa
{.experimental.}
import times
import threadpool
import future
let w = ["aa", "bb","cc"]
template parallelFor(
slice: Slice[int],
f:expr
) =
const a = slice.a