1Test::AutoBuild::Lock(3U)ser Contributed Perl DocumentatiToenst::AutoBuild::Lock(3)
2
3
4

NAME

6       Test::AutoBuild::Lock - Manage a lock file to prevent concurrent
7       execution
8

SYNOPSIS

10         use Test::AutoBuild::Lock
11

DESCRIPTION

13       This module takes out an exclusive lock on a file, preventing multiple
14       instances of the builder running concurrently against the same build
15       home. The scheme to use for locking the file, can be one of "flock",
16       "fcntl", or "file". "fcntl" is preferred since it works across NFS. If
17       this isn't supported on the OS running the builder, then "flock" should
18       be used. As a last resort the "file" method should be used, with does a
19       simple file presence/creation check, although if the builder fails in a
20       bad way it is possible the lock will not be cleaned up correctly.
21

METHODS

23       my $stage = Test::AutoBuild::Lock->new(file => $lock_file_path, method
24       => $lock_method);
25           Creates a new lock manager, for the file specified by the "file"
26           parameter. This should be a fully qualified path for the file to be
27           locked.  The file does not have to exist beforehand, but the path
28           must be writable by the user running the build instance. The
29           "method" parameter should be one of the strings 'fcntl', 'flock' or
30           'file' designating the method used to acquire the lock.
31
32       my $status = $lock->lock;
33           Attempt to acquire the lock, returning a true value if successfull,
34           otherwise a false value to indicate failure (due to the lock being
35           held by another process).
36
37       $lock->unlock;
38           Release a lock previously acquired by the "lock" method. If a lock
39           is not explicitly released, it will be unlocked during garbage
40           collection (via a DESTROY method hook on this object).
41

AUTHORS

43       Daniel Berrange <dan@berrange.com> Dennis Gregorovic
44       <dgregorovic@alum.mit.edu>
45
47       Copyright (C) 2004 Red Hat, Inc.  Copyright (C) 2005 Daniel Berrange.
48

SEE ALSO

50       perl(1), fcntl(2), flock(2), Test::AutoBuild
51
52
53
54perl v5.12.1                      2007-12-08          Test::AutoBuild::Lock(3)
Impressum