The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

munchies_lock - Provide set/reset locking semantics

SYNOPSIS

munchies_lock -c list

List the contents of the lock table

munchies_lock -c reset -k key

Reset the lock for key

munchies_lock -c set -k key -p pid [-t timeout]

Set the lock for key. Caller must provide it's PID. Timeout defaults to five minutes

munchies_lock -H|-h

Display man page/usage string

VERSION

0.6.$Rev: 1300 $

DESCRIPTION

This program exposes the subroutines in the IPC::SRLock module

Use one of three mechanisms to provide set/reset locking semantics. On Unix systems where the SysV IPC works use semaphores and shared memory. On Cygwin use flock(3m). There is also an implementation using libmemcached

Perl's portable flock(3m) mechanism to single thread access to the lock table. The lock table is a text file in XML format. Successful lock setting results in a line entry being written to the lock table. Other processes wishing to set the lock will suspend until the lock is released or times out. When released or timed out the line entry is removed from the lock table. The key can be any string (no commas), the pid should be the PID of the lock setting process, i.e. ${$} in Shell. The timeout defaults to five minutes.

REQUIRED ARGUMENTS

-c subroutine

One of list, reset, or set

OPTIONS

-D

Turn debugging on

-n

Do not prompt for debugging

DIAGNOSTICS

Prints errors to stderr

EXIT STATUS

Returns zero on success, non zero on failure

CONFIGURATION

Uses the constructor's appclass attribute to locate a configuration file

Locking mechanisms are selected in the OS dependant configuration file. Setting lock_type in the global config to ipc selects the SysV IPC method.

var/tmp/ipc_srlock.lck

The one true lock file

var/tmp/ipc_srlock.shm

The lock table

INCOMPATIBILITIES

None

DEPENDENCIES

App::Munchies::CLI

BUGS AND LIMITATIONS

Send reports to Support at RoxSoft.co.uk

AUTHOR

Peter Flanigan

LICENSE AND COPYRIGHT

Copyright (c) 2012 Peter Flanigan

This is free software; you can redistribute it and/or modify it under the same terms as Perl itself.