IPC-Locker
view release on metacpan or search on metacpan
lib/IPC/Locker.pm view on Meta::CPAN
Boolean flag, true indicates destruction of the lock variable should unlock
the lock, only if the current process id matches the pid passed to the
constructor. Set to false if destruction should not close the lock, such
as when other children destroying the lock variable should not unlock the
lock.
=item family
The family of transport to use, either INET or UNIX. Defaults to INET.
=item host
The name of the host containing the lock server. It may also be an array
of hostnames, where if the first one is down, subsequent ones will be
tried. Defaults to value of IPCLOCKER_HOST or localhost.
=item port
The port number (INET) or name (UNIX) of the lock server. Defaults to
IPCLOCKER_PORT environment variable, else 'lockerd' looked up via
/etc/services, else 1751.
=item lock
The name of the lock. This may also be a reference to an array of lock names,
and the first free lock will be returned.
=item lock_list
Return a list of lock and lock owner pairs. (You can assign this to a hash
for easier parsing.)
=item pid
The process ID that owns the lock, defaults to the current process id.
=item print_broke
A function to print a message when the lock is broken. The only argument
is self. Defaults to print a message if verbose is set.
=item print_down
A function to print a message when the lock server is unavailable. The
first argument is self. Defaults to a croak message.
=item print_obtained
A function to print a message when the lock is obtained after a delay. The
only argument is self. Defaults to print a message if verbose is set.
=item print_retry
A function to print a message when the lock server is unavailable, and is
about to be retried. The first argument is self. Defaults to a print
message.
=item print_waiting
A function to print a message when the lock is busy and needs to be waited
for. The first argument is self, second the name of the lock. Defaults to
print a message if verbose is set.
=item timeout
The maximum time in seconds that the lock may be held before being forced
open, passed to the server when the lock is created. Thus if the requester
dies, the lock will be released after that amount of time. Zero disables
the timeout. Defaults to 30 minutes.
=item user
Name to request the lock under, defaults to host_pid_user
=item autounlock
True to cause the server to automatically timeout a lock if the locking
process has died. For the process to be detected, it must be on the same
host as either the locker client (the host making the lock call), or the
locker server. Defaults false.
=item verbose
True to print messages when waiting for locks. Defaults false.
=back
=head1 ENVIRONMENT
=over 4
=item IPCLOCKER_HOST
Hostname of L<lockerd> server, or colon separated list including backup
servers. Defaults to localhost.
=item IPCLOCKER_PORT
The port number (INET) or name (UNIX) of the lock server. Defaults to
'lockerd' looked up via /etc/services, else 1751.
=back
=head1 DISTRIBUTION
The latest version is available from CPAN and from L<https://www.veripool.org/ipc-locker>.
Copyright 1999-2022 by Wilson Snyder. This package is free software; you
can redistribute it and/or modify it under the terms of either the GNU
Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.
=head1 AUTHORS
Wilson Snyder <wsnyder@wsnyder.org>
=head1 SEE ALSO
L<lockerd>, L<IPC::Locker::Server>
L<IPC::PidStat>, L<pidstat>, L<pidstatd>, L<pidwatch>
( run in 2.718 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )