module for pid lock files with atomic stale lock file takeover when possible
This commit is contained in:
parent
ecc203bde2
commit
710d1eeeac
4 changed files with 147 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue