fixes #10584 [backport]

(cherry picked from commit 65f3e390e8)
This commit is contained in:
Andreas Rumpf
2019-02-06 20:58:21 +01:00
committed by narimiran
parent 37ff8753a1
commit 99fc4029e0

View File

@@ -320,6 +320,10 @@ gSomeReady.initSemaphore()
proc slave(w: ptr Worker) {.thread.} =
isSlave = true
while true:
if w.shutdown:
w.shutdown = false
atomicDec currentPoolSize
break
when declared(atomicStoreN):
atomicStoreN(addr(w.ready), true, ATOMIC_SEQ_CST)
else:
@@ -340,9 +344,6 @@ proc slave(w: ptr Worker) {.thread.} =
dec numSlavesRunning
if w.q.len != 0: w.cleanFlowVars
if w.shutdown:
w.shutdown = false
atomicDec currentPoolSize
proc distinguishedSlave(w: ptr Worker) {.thread.} =
while true: