diff --git a/Utility/LockPool/LockHandle.hs b/Utility/LockPool/LockHandle.hs index 1fa8e7ca7b..ec36e6156c 100644 --- a/Utility/LockPool/LockHandle.hs +++ b/Utility/LockPool/LockHandle.hs @@ -10,6 +10,7 @@ module Utility.LockPool.LockHandle where import qualified Utility.LockPool.STM as P +import Utility.LockPool.STM (LockFile) import Control.Concurrent.STM import Control.Exception @@ -22,13 +23,18 @@ data LockHandle = LockHandle data FileLockOps = FileLockOps { fDropLock :: IO () #ifndef mingw32_HOST_OS - , fCheckSaneLock :: FilePath -> IO Bool + , fCheckSaneLock :: LockFile -> IO Bool #endif } dropLock :: LockHandle -> IO () dropLock h = P.releaseLock (poolHandle h) (fDropLock (fileLockOps h)) +#ifndef mingw32_HOST_OS +checkSaneLock :: LockFile -> LockHandle -> IO Bool +checkSaneLock lockfile (LockHandle _ flo) = fCheckSaneLock flo lockfile +#endif + -- Take a lock, by first updating the lock pool, and then taking the file -- lock. If taking the file lock fails for any reason, take care to -- release the lock in the lock pool. diff --git a/Utility/LockPool/PidLock.hs b/Utility/LockPool/PidLock.hs index 3d90e4b42d..dc796b961d 100644 --- a/Utility/LockPool/PidLock.hs +++ b/Utility/LockPool/PidLock.hs @@ -53,9 +53,6 @@ getLockStatus file = P.getLockStatus P.lockPool file (StatusLockedBy <$> getProcessID) (F.getLockStatus file) -checkSaneLock :: LockFile -> LockHandle -> IO Bool -checkSaneLock lockfile (LockHandle _ flo) = fCheckSaneLock flo lockfile - mk :: F.LockHandle -> FileLockOps mk h = FileLockOps { fDropLock = F.dropLock h diff --git a/Utility/LockPool/Posix.hs b/Utility/LockPool/Posix.hs index eb679b7e89..a77ed8f01b 100644 --- a/Utility/LockPool/Posix.hs +++ b/Utility/LockPool/Posix.hs @@ -67,9 +67,6 @@ getLockStatus file = P.getLockStatus P.lockPool file (StatusLockedBy <$> getProcessID) (F.getLockStatus file) -checkSaneLock :: LockFile -> LockHandle -> IO Bool -checkSaneLock lockfile (LockHandle _ flo) = fCheckSaneLock flo lockfile - mk :: F.LockHandle -> FileLockOps mk h = FileLockOps { fDropLock = F.dropLock h