NAME

KinoSearch::Store::SharedLock - Shared (read) lock.

SYNOPSIS

my $lock_factory = KinoSearch::Store::LockFactory->new(
    folder    => $folder,
    agent_id  => $hostname,
);
my $lock = $lock_factory->make_shared_lock(
    lock_name => 'segments_6r',
    timeout   => 5000,
);

DESCRIPTION

SharedLock's interface is nearly identical to that of its parent class KinoSearch::Store::Lock, taking the same constructor arguments and implementing the same list of methods. It differs from Lock only in the semantics of two methods:

  • obtain() will not fail if another lock is held against lock_name (though it might fail for other reasons).

  • is_locked() returns true so long as some lock, somewhere is holding a lock on the resource identified by lock_name. That lock could be this instance, or it could be another. So this sequence is entirely possible:

    $lock->release; # works this time
    $lock->release; # doesn't do anything
    print "Still locked!" if $lock->is_locked; # prints "Still locked!"

COPYRIGHT

Copyright 2007 Marvin Humphrey

LICENSE, DISCLAIMER, BUGS, etc.

See KinoSearch version 0.20.