I think we will not be able to compile your code, as it looks not like a
complete program.
Do you really expect that
cnt += spawn segcount(i*KB, Kn)
may work? I have no idea how it could.
Maybe what you intent is something like
parallel:
var cnt = array[rescnt, int]
for i in 0..<rescnt:
cnt[i] = spawn segcount(i*KB, Kn)
sync()
for i in 0..<rescnt:
primecnt += cnt[i].uint
Such a shape would make some sense for me, but I have not used Nim's parallel
in the last two years, so I would have to consult the manual.