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)) 
    
    
    parallelFor(0..2) do(i: int) {.closure.}: writeFile("dict_" & $i & 
".txt",enumerableRepeat(w[i], 3_000_000))
    

I get "Error: 'spawn' takes a GC safe call expression". To the compiler did not 
swear, I used the option **\--threadAnalysis:off**

But is there any other way? Is it possible to make a template **parallelFor** 
(or iterator **enumerableRepeat**?) thread-safe?

Reply via email to