PApp::Lock - manage locks using sql
use PApp::Lock; # not auto-imported into .papp-files
locked { ... locked code section } "my_app_lock", 60, 60*10;
This module manages locking (semaphores) using the papp state database (i.e. it works without filesystem and across hosts).
new
method for the
meaning of the arguments.
name
. The name
might be used case-sensitive or -insensitive, so always use the same
spel[l]ing but don't expect that lock names are case-sensitive. timeout
specifies the maximum time
that the program waits until the lock becomes available (default: 5 minutes). holdtime
specifies the maximum
age the lock can have (default: 12 hours). A lock older than holdtime
is broken.
lock([timeout])
See new
for the meaning of timeout
.
Marc Lehmann <pcg@goof.com> http://www.goof.com/pcg/marc/