ouroboros-consensus-0.21.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Consensus.Util.FileLock

Synopsis

Documentation

data FileLock m Source #

Abstraction for file locks

Constructors

FileLock 

Fields

  • lockFileFilePath → 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.

ioFileLockFileLock 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.