To expand on cumolonimbus:
Instead of having this
{.push: thread.}
proc worker(f: string, t: guarded ptr Table) =
for line in f.lines:
for w in line.split:
let h = w.hash
lock t.locks[h and (0x100-1)]:
t.buckets[h and (0x1000-1)].inc(w)
{.pop.}
Run
Having
{.pushpop: thread.}
proc worker(f: string, t: guarded ptr Table) =
for line in f.lines:
for w in line.split:
let h = w.hash
lock t.locks[h and (0x100-1)]:
t.buckets[h and (0x1000-1)].inc(w)
Run
It can be called `once` or anything else. I guess this is similar to the
`using` pragma as well.