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
|
liftIO $ atomically $ waitWorkerSlot' (== newstage) tv >>= \case
|
||||||
Just idlest -> do
|
Just idlest -> do
|
||||||
pool <- takeTMVar tv
|
pool <- takeTMVar tv
|
||||||
|
let restorepool = addWorkerPool (IdleWorker idlest newstage) pool
|
||||||
let pool' = case removeThreadIdWorkerPool mytid pool of
|
let pool' = case removeThreadIdWorkerPool mytid pool of
|
||||||
Just ((myaid, oldstage), p) ->
|
Just ((myaid, oldstage), p) ->
|
||||||
addWorkerPool (IdleWorker idlest oldstage) $
|
addWorkerPool (IdleWorker idlest oldstage) $
|
||||||
addWorkerPool (ActiveWorker myaid newstage) p
|
addWorkerPool (ActiveWorker myaid newstage) p
|
||||||
Nothing -> pool
|
Nothing -> restorepool
|
||||||
putTMVar tv pool'
|
putTMVar tv pool'
|
||||||
-- No worker pool is allocated, not running in concurrent
|
-- No worker pool is allocated, not running in concurrent
|
||||||
-- mode.
|
-- mode.
|
||||||
|
|
Loading…
Reference in a new issue