From 2e819796cdfdfccb2ebef7b10e2653e58d832d83 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 19 May 2015 14:10:13 -0400 Subject: convert lockContent to use new LockPools Also cleaned up the code, avoiding creating a lock file if we're going to open it for create later anyway. And, if there's an exception while preparing to lock the file, but not at the point of actually taking the lock, throw an exception, instead of silently not locking and pretending to succeed. And, on Windows, always use lock file, even if the repo somehow got into indirect mode (maybe with cygwin git..) --- Utility/LockFile/Posix.hs | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'Utility') diff --git a/Utility/LockFile/Posix.hs b/Utility/LockFile/Posix.hs index 12275c48a..65ba328df 100644 --- a/Utility/LockFile/Posix.hs +++ b/Utility/LockFile/Posix.hs @@ -10,8 +10,6 @@ module Utility.LockFile.Posix ( lockShared, lockExclusive, tryLockExclusive, - createLockFile, - openExistingLockFile, checkLocked, getLockStatus, dropLock, @@ -56,15 +54,6 @@ lock lockreq mode lockfile = do waitToSetLock l (lockreq, AbsoluteSeek, 0, 0) return (LockHandle l) --- Create and opens lock file; does not lock it. -createLockFile :: FileMode -> LockFile -> IO Fd -createLockFile filemode = openLockFile (Just filemode) - --- Opens an existing lock file; does not lock it, and if it does not exist, --- returns Nothing. -openExistingLockFile :: LockFile -> IO (Maybe Fd) -openExistingLockFile = catchMaybeIO . openLockFile Nothing - -- Close on exec flag is set so child processes do not inherit the lock. openLockFile :: Maybe FileMode -> LockFile -> IO Fd openLockFile filemode lockfile = do -- cgit v1.2.3