summaryrefslogtreecommitdiff
path: root/Annex/LockFile.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-11-12 18:05:45 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-11-12 18:13:37 -0400
commit6b074fb7e741020b81d696bd66e62f75fd472966 (patch)
tree284ac39d6ce641c255555e504c89a9f4d9956744 /Annex/LockFile.hs
parent549f635c6b64006b5a369795805d08b8f439d54c (diff)
convert from Utility.LockPool to Annex.LockPool everywhere
Diffstat (limited to 'Annex/LockFile.hs')
-rw-r--r--Annex/LockFile.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/Annex/LockFile.hs b/Annex/LockFile.hs
index 928b36ec5..40f9c6b2a 100644
--- a/Annex/LockFile.hs
+++ b/Annex/LockFile.hs
@@ -20,7 +20,7 @@ import Annex
import Types.LockCache
import qualified Git
import Annex.Perms
-import Utility.LockPool
+import Annex.LockPool
import qualified Data.Map as M
@@ -33,7 +33,7 @@ lockFileCached file = go =<< fromLockCache file
go Nothing = do
#ifndef mingw32_HOST_OS
mode <- annexFileMode
- lockhandle <- liftIO $ noUmask mode $ lockShared (Just mode) file
+ lockhandle <- noUmask mode $ lockShared (Just mode) file
#else
lockhandle <- liftIO $ waitToLock $ lockShared file
#endif
@@ -64,12 +64,12 @@ withExclusiveLock getlockfile a = do
lockfile <- fromRepo getlockfile
createAnnexDirectory $ takeDirectory lockfile
mode <- annexFileMode
- bracketIO (lock mode lockfile) dropLock (const a)
+ bracket (lock mode lockfile) (liftIO . dropLock) (const a)
where
#ifndef mingw32_HOST_OS
lock mode = noUmask mode . lockExclusive (Just mode)
#else
- lock _mode = waitToLock . lockExclusive
+ lock _mode = liftIO . waitToLock . lockExclusive
#endif
{- Tries to take an exclusive lock and run an action. If the lock is
@@ -79,12 +79,12 @@ tryExclusiveLock getlockfile a = do
lockfile <- fromRepo getlockfile
createAnnexDirectory $ takeDirectory lockfile
mode <- annexFileMode
- bracketIO (lock mode lockfile) unlock go
+ bracket (lock mode lockfile) (liftIO . unlock) go
where
#ifndef mingw32_HOST_OS
lock mode = noUmask mode . tryLockExclusive (Just mode)
#else
- lock _mode = lockExclusive
+ lock _mode = liftIO . lockExclusive
#endif
unlock = maybe noop dropLock
go Nothing = return Nothing