cas-store-1.0.1: A content-addressed storage

Safe HaskellNone
LanguageHaskell2010

Data.CAS.Lock

Description

Thread and process write lock.

Allows synchronisation between threads and processes. Uses an MVar for synchronisation between threads and fcntl write locks for synchronisation between processes.

Only ever have one Lock object per lock file per process!

Synopsis

Documentation

data Lock Source #

Thread and process write lock.

Only ever have one Lock object per lock file per process!

openLock :: Path Abs Dir -> IO Lock Source #

Open the lock file and create a lock object.

This does not acquire the lock.

Only ever have one Lock object per lock file per process!

closeLock :: Lock -> IO () Source #

Close the lock file.

Does not release the lock.

Blocks if the lock is taken.

withLock :: MonadBaseControl IO m => Lock -> m a -> m a Source #

Acquire the lock for the duration of the given action and release after.