ouroboros-consensus-0.1.0.1: Consensus layer for the Ouroboros blockchain protocol
Safe Haskell Safe-Inferred
Language Haskell2010

Ouroboros.Consensus.Util.FileLock

Synopsis

Documentation

data FileLock m Source #

Abstraction for file locks

Constructors

FileLock

Fields

  • lockFile :: FilePath -> m (m ())

    Obtain an exclusive lock on the given file.

    Returns the function to unlock the file.

    Blocks until the lock is available.

    We don't guarantee the ability to read/write to a locked file, not even when holding the lock.

ioFileLock :: FileLock IO Source #

Implementation of FileLock for IO , using on System.FileLock .

Locking the file can block in FFI, so not interruptible.

Unlocking the file is not guaranteed to be synchronous. Near instantaneous on Linux, but not synchronous. On Windows, unlocking is even more lazy.