| Safe Haskell | Trustworthy |
|---|---|
| Language | Haskell2010 |
Lukko.OFD
Contents
Description
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 #
Exception thrown by hLock on non-Windows platforms that don't support
flock.
Constructors
| FileLockingNotSupported |
Instances
| Show FileLockingNotSupported # | |
Defined in Lukko.Internal.Types Methods showsPrec :: Int -> FileLockingNotSupported -> ShowS # show :: FileLockingNotSupported -> String # showList :: [FileLockingNotSupported] -> ShowS # | |
| Exception FileLockingNotSupported # | |
Defined in Lukko.Internal.Types | |
fileLockingSupported :: Bool #
A constants specifying whether file locking is supported.
type FileLockingSupported = True #
A type level fileLockingSupported.
data FileLockingMethod #
Potentially availble lock methods.
Constructors
| MethodOFD | open file descriptor locking |
| MethodFLock | BSD |
| MethodWindows | Windows locking |
| MethodNoOp | No-Op (throws |
Instances
fileLockingMethod :: FileLockingMethod #
A constant specifying this method
Indicates a mode in which a file should be locked.
Constructors
| SharedLock | |
| ExclusiveLock |