This commit is contained in:
Joey Hess 2015-11-12 16:35:15 -04:00
parent 0f25a7365a
commit 7bd9e33b84
Failed to extract signature
3 changed files with 7 additions and 7 deletions

View file

@ -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.

View file

@ -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

View file

@ -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