module for pid lock files with atomic stale lock file takeover when possible

This commit is contained in:
Joey Hess 2015-11-12 15:38:02 -04:00
parent ecc203bde2
commit 710d1eeeac
Failed to extract signature
4 changed files with 147 additions and 4 deletions

View file

@ -20,6 +20,7 @@ module Utility.LockFile.Posix (
import Utility.Exception
import Utility.Applicative
import Utility.LockFile.LockStatus
import System.IO
import System.Posix
@ -80,9 +81,6 @@ openLockFile lockreq filemode lockfile = do
checkLocked :: LockFile -> IO (Maybe Bool)
checkLocked = maybe Nothing (Just . isJust) <$$> getLockStatus'
data LockStatus = StatusUnLocked | StatusLockedBy ProcessID | StatusNoLockFile
deriving (Eq)
getLockStatus :: LockFile -> IO LockStatus
getLockStatus lockfile = do
v <- getLockStatus' lockfile