I tried running your code under helgrind.
valgrind --tool=helgrind test
It reported a data race:
==24599== ----------------------------------------------------------------
==24599==
==24599== Possible data race during read of size 8 at 0x33B168 by thread #1
==24599== Locks held: none
==24599== at 0x118490: nimSpawn3 (stdlib_threadpool.c:394)
==24599== by 0x10948A: NimMainModule (test.c:186)
==24599== by 0x10943E: NimMain (test.c:165)
==24599== by 0x10918C: main (test.c:172)
==24599==
==24599== This conflicts with a previous write of size 8 by thread #5
==24599== Locks held: none
==24599== at 0x11813A: slave_ZLEiMrITYl7xqyEhA5iC1g
(stdlib_threadpool.c:281)
==24599== by 0x1156FB: threadProcWrapDispatch_t0lnloO9aBTBU0elWgvMSlw_2
(stdlib_system.c:4330)
==24599== by 0x115811: threadProcWrapStackFrame_t0lnloO9aBTBU0elWgvMSlw
(stdlib_system.c:4454)
==24599== by 0x115811: threadProcWrapper_2AvjU29bJvs3FXJIcnmn4Kg
(stdlib_system.c:4472)
==24599== by 0x4C32D06: mythread_wrapper (hg_intercepts.c:389)
==24599== by 0x5555493: start_thread (pthread_create.c:333)
==24599== by 0x5853AFE: clone (clone.S:97)
==24599== Address 0x33b168 is 0 bytes inside data symbol
"readyWorker_BT69aUhVoxO4qq9b8EinSVNA"
==24599==
==24599== ----------------------------------------------------------------