LockFile::Simple

LockFile::Simple is a simple file locking scheme.
Download

LockFile::Simple Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Raphael Manfredi
  • Publisher web site:
  • http://search.cpan.org/~mrogaski/Log-Agent-0.307/Agent/Tag/Callback.pm

LockFile::Simple Tags


LockFile::Simple Description

LockFile::Simple is a simple file locking scheme. LockFile::Simple is a simple file locking scheme.SYNOPSIS use LockFile::Simple qw(lock trylock unlock); # Simple locking using default settings lock("/some/file") || die "can't lock /some/filen"; warn "already lockedn" unless trylock("/some/file"); unlock("/some/file"); # Build customized locking manager object $lockmgr = LockFile::Simple->make(-format => '%f.lck', -max => 20, -delay => 1, -nfs => 1); $lockmgr->lock("/some/file") || die "can't lock /some/filen"; $lockmgr->trylock("/some/file"); $lockmgr->unlock("/some/file"); $lockmgr->configure(-nfs => 0); # Using lock handles my $lock = $lockmgr->lock("/some/file"); $lock->release;This simple locking scheme is not based on any file locking system calls such as flock() or lockf() but rather relies on basic file system primitives and properties, such as the atomicity of the write() system call. It is not meant to be exempt from all race conditions, especially over NFS. The algorithm used is described below in the ALGORITHM section.It is possible to customize the locking operations to attempt locking once every 5 seconds for 30 times, or delete stale locks (files that are deemed too ancient) before attempting the locking. Requirements: · Perl


LockFile::Simple Related Software