Thank you for your posts.
I think the behavior is a matter of the Nim compiler. aSeq is deepcopied into
aSeqPar and aSeqPar behaves as if it is declared locally within workerTread as
"let aSeqPar = aSeq". But I would prefer: "var aSeqPar = aSeq". Obviously there
exists no suitable pragma too.
Please look at **Why not?** at the right.
But it works when the sequence is copied.
Could't this unnecessary overhead be avoided?
import sequtils, os, threadpool
var aSeq = @[10, 20, 30]
echo "aSeq=", repr(aSeq)
proc workerThread(aSeqPar: seq[int]) =
# aS