fix sshCleanup race using STM

This commit is contained in:
Joey Hess 2017-05-11 18:29:51 -04:00
parent 191665e7f0
commit 3f4b671486
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 19 additions and 22 deletions

View file

@ -71,6 +71,7 @@ import Utility.Url
import "mtl" Control.Monad.Reader
import Control.Concurrent
import Control.Concurrent.Async
import Control.Concurrent.STM
import qualified Data.Map as M
import qualified Data.Set as S
@ -124,7 +125,7 @@ data AnnexState = AnnexState
, groupmap :: Maybe GroupMap
, ciphers :: M.Map StorableCipher Cipher
, lockcache :: LockCache
, sshstalecleaned :: MVar ()
, sshstalecleaned :: TMVar Bool
, flags :: M.Map String Bool
, fields :: M.Map String String
, cleanup :: M.Map CleanupAction (Annex ())
@ -147,7 +148,7 @@ newState :: GitConfig -> Git.Repo -> IO AnnexState
newState c r = do
emptyactiveremotes <- newMVar M.empty
o <- newMessageState
sc <- newMVar ()
sc <- newTMVarIO False
return $ AnnexState
{ repo = r
, repoadjustment = return