NAME

LinkedList::Single::Example::Lock - a stand-in lock that records how long it was held

SYNOPSIS

my $lock   = LinkedList::Single::Example::Lock->new;

my $result = $lock->hold( sub( @arg ) { ... }, @arg );

printf "%d acquisitions, %.6f seconds held\n"
, $lock->acquired
, $lock->held_secs;

DESCRIPTION

See LinkedList::Single::Example::Handoff::POD. The lock is not re-entrant: taking it while it is held croaks, which catches a method that calls another locked method.