module Nfs:sig..end
There are a few caveats compared to local file locks:
val create : ?message:string -> string -> boollock ?message path tries to create and lock the file at path by creating a hard
link to path.nfs_lock. The contents of path will be replaced with message,
which will be the caller's hostname:pid by default.
Efforts will be made to release this lock when the calling program exits. But there
is no guarantee that this will occur under some types of program crash. If the
program crashes without removing the lock file an attempt will be made to clean up
on restart by checking the hostname and pid stored in the lockfile.
val create_exn : ?message:string -> string -> unitcreate_exn ?message path like create, but throws an exception when it fails to
obtain the lockval blocking_create : ?message:string -> string -> unitblocking_create ?message path like create, but sleeps for 1 second between lock
attempts and does not return until it succeedsval critical_section : ?message:string -> string -> f:(unit -> 'a) -> 'acritical_section ?message path ~f wrap function f (including exceptions escaping
it) by first locking (using Lock_file.Nfs.create_exn) and then unlocking the given lock
file.val get_hostname_and_pid : string -> (string * Pid.t) optionget_hostname_and_pid path reads the lock file at path and returns the hostname
and path in the file if it can be parsed.