This commit is contained in:
Joey Hess 2019-06-19 14:52:44 -04:00
parent 9d36c826c0
commit 05a908c3c9
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -94,10 +94,9 @@ enteringStage :: WorkerStage -> Annex a -> Annex a
enteringStage newstage a = do
mytid <- liftIO myThreadId
tv <- Annex.getState Annex.workers
let setup = changeStageTo mytid tv newstage
let cleanup Nothing = noop
let cleanup (Just oldstage) = changeStageTo mytid tv oldstage
bracket setup cleanup (const a)
let set = changeStageTo mytid tv newstage
let restore = maybe noop (void . changeStageTo mytid tv)
bracket set restore (const a)
changeStageTo :: ThreadId -> TMVar (WorkerPool AnnexState) -> WorkerStage -> Annex (Maybe WorkerStage)
changeStageTo mytid tv newstage = liftIO $ atomically $ do