diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-11-12 18:05:45 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-11-12 18:13:37 -0400 |
commit | 6b074fb7e741020b81d696bd66e62f75fd472966 (patch) | |
tree | 284ac39d6ce641c255555e504c89a9f4d9956744 /Annex/Content.hs | |
parent | 549f635c6b64006b5a369795805d08b8f439d54c (diff) |
convert from Utility.LockPool to Annex.LockPool everywhere
Diffstat (limited to 'Annex/Content.hs')
-rw-r--r-- | Annex/Content.hs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs index bc28cc6b4..5990d194a 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -62,7 +62,7 @@ import Annex.Perms import Annex.Link import Annex.Content.Direct import Annex.ReplaceFile -import Utility.LockPool +import Annex.LockPool import Messages.Progress import qualified Types.Remote import qualified Types.Backend @@ -113,12 +113,12 @@ inAnnexSafe key = inAnnex' (fromMaybe True) (Just False) go key =<< contentLockFile key #ifndef mingw32_HOST_OS - checkindirect contentfile = liftIO $ checkOr is_missing contentfile + checkindirect contentfile = checkOr is_missing contentfile {- In direct mode, the content file must exist, but - the lock file generally won't exist unless a removal is in - process. -} - checkdirect contentfile lockfile = liftIO $ - ifM (doesFileExist contentfile) + checkdirect contentfile lockfile = + ifM (liftIO $ doesFileExist contentfile) ( checkOr is_unlocked lockfile , return is_missing ) @@ -186,7 +186,7 @@ lockContentShared key a = lockContentUsing lock key $ do withVerifiedCopy LockedCopy u (return True) a where #ifndef mingw32_HOST_OS - lock contentfile Nothing = liftIO $ tryLockShared Nothing contentfile + lock contentfile Nothing = tryLockShared Nothing contentfile lock _ (Just lockfile) = posixLocker tryLockShared lockfile #else lock = winLocker lockShared @@ -205,7 +205,7 @@ lockContentForRemoval key a = lockContentUsing lock key $ lock contentfile Nothing = bracket_ (thawContent contentfile) (freezeContent contentfile) - (liftIO $ tryLockExclusive Nothing contentfile) + (tryLockExclusive Nothing contentfile) lock _ (Just lockfile) = posixLocker tryLockExclusive lockfile #else lock = winLocker lockExclusive @@ -216,11 +216,11 @@ lockContentForRemoval key a = lockContentUsing lock key $ type ContentLocker = FilePath -> Maybe LockFile -> Annex (Maybe LockHandle) #ifndef mingw32_HOST_OS -posixLocker :: (Maybe FileMode -> LockFile -> IO (Maybe LockHandle)) -> LockFile -> Annex (Maybe LockHandle) +posixLocker :: (Maybe FileMode -> LockFile -> Annex (Maybe LockHandle)) -> LockFile -> Annex (Maybe LockHandle) posixLocker takelock lockfile = do mode <- annexFileMode modifyContent lockfile $ - liftIO $ takelock (Just mode) lockfile + takelock (Just mode) lockfile #else winLocker :: (LockFile -> IO (Maybe LockHandle)) -> ContentLocker |