Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
Linux open file descriptor locking.
https://www.gnu.org/software/libc/manual/html_node/Open-File-Description-Locks.html
We prefer this over BSD locking (e.g. flock) since the latter appears to break in some NFS configurations. Note that we intentionally do not try to use ordinary POSIX file locking due to its peculiar semantics under multi-threaded environments.
Synopsis
- data FileLockingNotSupported = FileLockingNotSupported
- fileLockingSupported :: Bool
- type FileLockingSupported = True
- data FileLockingMethod
- fileLockingMethod :: FileLockingMethod
- data LockMode
- data FD
- fdOpen :: FilePath -> IO FD
- fdClose :: FD -> IO ()
- fdLock :: FD -> LockMode -> IO ()
- fdTryLock :: FD -> LockMode -> IO Bool
- fdUnlock :: FD -> IO ()
- hLock :: Handle -> LockMode -> IO ()
- hTryLock :: Handle -> LockMode -> IO Bool
- hUnlock :: Handle -> IO ()
Types
data FileLockingNotSupported Source #
Exception thrown by hLock
on non-Windows platforms that don't support
flock
.
Instances
Show FileLockingNotSupported Source # | |
Defined in Lukko.Internal.Types showsPrec :: Int -> FileLockingNotSupported -> ShowS # show :: FileLockingNotSupported -> String # showList :: [FileLockingNotSupported] -> ShowS # | |
Exception FileLockingNotSupported Source # | |
fileLockingSupported :: Bool Source #
A constants specifying whether file locking is supported.
type FileLockingSupported = True Source #
A type level fileLockingSupported
.
data FileLockingMethod Source #
Potentially availble lock methods.
MethodOFD | open file descriptor locking |
MethodFLock | BSD |
MethodWindows | Windows locking |
MethodNoOp | No-Op (throws |
Instances
fileLockingMethod :: FileLockingMethod Source #
A constant specifying this method