cs::Lock - cross host NFS-safe locking
use cs::Lock;
This module obtains a lock on a resource via an agreed name and lock directory.
The current implementation uses directories for the lock objects. The Put method, if used, then makes files in these directories.
Return the pathname of the lock object to be obtained from the key supplied.
Check if the lock specified by key is taken.
Obtain a lock on the resource specified by key. If maxtries is greater than zero, try to take the lock that many times before failure (returning undef). Successive attempts are separated by an increasing delay, up to a maximum. If maxtries equals zero, try forever. If maxtries is less than zero, return a lock object anyway (so that the current lock parameters may be queried). If not supplied, maxtries defaults to zero. If supplied and true, silent specifies that locks delayed for a noticable amount of time are not reported to STDERR.
Taken()
Return whether the lock was successfully obtained. This can only return false if the object was acquired with maxtries less than zero and the lock already taken by someone else.
Path()
Return the pathname of the lock object.
Write the text info to the record base in the lock object, followed by a newline. If not specified, base defaults to ``info''.
Retrieve the text stored in the record base in the lock object. If not specified, base defaults to ``info''.
The lock directory is chosen as follows: the directory named in the environment variable $LOCKDIR, or the subdirectory locks of the directory returned by cs::Misc::tmpDir(3) if it exists, or the directory $HOME/.locks.
LOCKDIR - the preferred directory for locks.
Cameron Simpson <cs@zip.com.au>