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

use IPC::ConcurrencyLimit;

Very simple base class for locks defining a common interface.
If you are just looking to use IPC::ConcurrencyLimit, you don't need this.

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.
The destructor (none implemented in the base class) needs to release the lock.
Returns the id of the lock (starting at 1, not 0).
When called, must return whether the lock is still valid. By default, this just returns true unless overridden in subclasses.

Steffen Mueller, smueller@cpan.org
Yves Orton

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.

(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.