lukko-0.1.1.2: File locking

Safe HaskellTrustworthy
LanguageHaskell2010

Lukko.FLock

Contents

Description

File locking via BSD-style flock(2).

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 BSD-style locks.

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

Try to lock using BSD-style locks.

fdUnlock :: FD -> IO () Source #

Unlock using BSD-style locks.

Handles

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

Lock using BSD-style locks.

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

Try to lock using BSD-style locks.

hUnlock :: Handle -> IO () Source #

Unlock using BSD-style locks.