fix restoring worker pool bug
The bug might have led to a STM deadlock, if this case could ever actually fire.
This commit is contained in:
parent
1a8d06d251
commit
ecbd456312
1 changed files with 2 additions and 1 deletions
|
@ -193,11 +193,12 @@ changeStageTo newstage = do
|
|||
liftIO $ atomically $ waitWorkerSlot' (== newstage) tv >>= \case
|
||||
Just idlest -> do
|
||||
pool <- takeTMVar tv
|
||||
let restorepool = addWorkerPool (IdleWorker idlest newstage) pool
|
||||
let pool' = case removeThreadIdWorkerPool mytid pool of
|
||||
Just ((myaid, oldstage), p) ->
|
||||
addWorkerPool (IdleWorker idlest oldstage) $
|
||||
addWorkerPool (ActiveWorker myaid newstage) p
|
||||
Nothing -> pool
|
||||
Nothing -> restorepool
|
||||
putTMVar tv pool'
|
||||
-- No worker pool is allocated, not running in concurrent
|
||||
-- mode.
|
||||
|
|
Loading…
Reference in a new issue