Manual Reference Pages - PARANOID::LOCKFILE (3)
Paranoid::Lockfile - Paranoid Lockfile support
$Id: Lockfile.pm,v 0.65 2011/12/08 07:53:07 acorliss Exp $
$rv = plock($lockfile);
$rv = punlock($lockfile);
$rv = pcloseLockfile($lockfile);
This modules provides a relatively safe locking mechanism across multiple
processes. This does not work over NFS or across remote systems, this is
only intended for use on a single system at a time, and only on those that
<B>sysopenB> is used to avoid race conditions with multiple process attempting
to create the same file simultaneously.
$rv = plock($filename);
This function attempts to safely create or open the lockfile. It uses
<B>sysopenB> with <B>O_CREAT | O_EXCLB> to avoid race conditions with other
processes. Returns a true if successful.
Your can pass an optional second argument which would be a string of either
write or shared. The default is write, which locks the file in
exclusive write mode.
You can pass an optional third argument which would be the lockfile
filesystem permissions if the file is created. The default is 0600.
<B>NOTE:B> This function will block until the advisory lock is granted.
$rv = punlock($filename);
This function removes any existing locks on the specified filename using
<B>flockB>. If no previous lock existed or it was successful it returns true.
This does not, however, close the open filehandle to the lockfile.
$rv = pcloseLockfile($filename);
This function releases any existing locks and closes the open filehandle to
the lockfile. Returns true if the file isnt currently open or the operation
BUGS AND LIMITATIONS
Arthur Corliss (firstname.lastname@example.org)
LICENSE AND COPYRIGHT
This software is licensed under the same terms as Perl, itself.
Please see http://dev.perl.org/licenses/ for more information.
(c) 2005, Arthur Corliss (email@example.com)
|perl v5.20.3 ||PARANOID::LOCKFILE (3) ||2011-12-08 |
Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.