Steffen Müller > IPC-ConcurrencyLimit-0.10 > IPC::ConcurrencyLimit::Lock

Download:
IPC-ConcurrencyLimit-0.10.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source   Latest Release: IPC-ConcurrencyLimit-0.11

NAME ^

IPC::ConcurrencyLimit::Lock - Simple base class for lock implementations

SYNOPSIS ^

  use IPC::ConcurrencyLimit;

DESCRIPTION ^

Very simple base class for locks defining a common interface.

If you are just looking to use IPC::ConcurrencyLimit, you don't need this.

METHODS ^

new

Constructor that acquires a new lock and returns undef on failure to acquire a lock.

Needs to be implemented in the subclass.

First argument is a hash reference containing options including at least max_procs which indicates the maximum number of locks at the same time.

Note to implementors: Copy the hash if you need to store it.

DESTROY

The destructor (none implemented in the base class) needs to release the lock.

id

Returns the id of the lock (starting at 1, not 0).

heartbeat

When called, must return whether the lock is still valid. By default, this just returns true unless overridden in subclasses.

AUTHOR ^

Steffen Mueller, smueller@cpan.org

Yves Orton

ACKNOWLEDGMENT ^

This module was originally developed for booking.com. With approval from booking.com, this module was generalized and put on CPAN, for which the authors would like to express their gratitude.

COPYRIGHT AND LICENSE ^

 (C) 2011, 2012 Steffen Mueller. All rights reserved.
 
 This code is available under the same license as Perl version
 5.8.1 or higher.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
syntax highlighting: