lukko-0.1: File locking

Safe HaskellTrustworthy
LanguageHaskell2010

Lukko.FLock

Contents

Description

File locking via POSIX flock.

Synopsis

Types

fileLockingSupported :: Bool Source #

A constants specifying whether file locking is supported.

data FileLockingMethod Source #

Potentially availble lock methods.

Constructors

MethodOFD

open file descriptor locking

MethodFLock

BSD flock

MethodWindows

Windows locking

MethodNoOp

No-Op (throws FileLockingNotSupported)

Instances
Bounded FileLockingMethod Source # 
Instance details

Defined in Lukko.Internal.Types

Enum FileLockingMethod Source # 
Instance details

Defined in Lukko.Internal.Types

Eq FileLockingMethod Source # 
Instance details

Defined in Lukko.Internal.Types

Ord FileLockingMethod Source # 
Instance details

Defined in Lukko.Internal.Types

Show FileLockingMethod Source # 
Instance details

Defined in Lukko.Internal.Types

fileLockingMethod :: FileLockingMethod Source #

A constant specifying this method

data LockMode Source #

Indicates a mode in which a file should be locked.

Constructors

SharedLock 
ExclusiveLock 

File descriptors

data FD Source #

Opaque file descriptor

This is a wrapper over CInt

fdOpen :: FilePath -> IO FD Source #

Open file to be used for locking.

open(path, O_RDWR | O_CREAT);

fdClose :: FD -> IO () Source #

Close lock file.

close(fd);

fdLock :: FD -> LockMode -> IO () Source #

Lock using OFD locks.

fdTryLock :: FD -> LockMode -> IO Bool Source #

Try to lock using OFD locks.

fdUnlock :: FD -> IO () Source #

Unlock using OFD locks.

Handles

hLock :: Handle -> LockMode -> IO () Source #

Lock using OFD locks.

hTryLock :: Handle -> LockMode -> IO Bool Source #

Try to lock using OFD locks.

hUnlock :: Handle -> IO () Source #

Unlock using OFD locks.