IPC-LockTicket
view release on metacpan or search on metacpan
If not called, the next C<MainLock()> will clear the orphan file, but it is not clear that the content was written properly. If the file is empty or cannot be read, it will not be cleared, but C<MainLock()> will fail. See L<C<MainLock>> for further d...
=cut
=head3 C<MainLock>
my $bol_Success = $object->MainLock();
my $bol_Success = $object->MainLock(1);
Checks if a lock file exists and creates it if not. Fails if file exists and process stored within is alive.
If a C<true> value is supplied, locking is non-exclusive but shared. If the file exists and was also created non-exclusively, locking is successful. This way the lock file is shared with several processes, requesting non-exclusive mode.
If C<false> is returned from C<MainLock> no lock file was created/claimed.
Meaning:
____________________________________________________________________________________________________________________________________
| Call mode | MainLock() | MainLock() | MainLock() | MainLock() | MainLock(1) | MainLock(1) | MainLock(1) | MainLock(1) |
| Lock file | empty* | shared | exclusive | non-existent | empty* | shared | exclusive | non-existent |
| MainLock returns | false | false | false | true | false | true | false | true |
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯Â...
lib/IPC/LockTicket.pm view on Meta::CPAN
}
return($objSelf->{_harData}{bolAllowMultiple});
}
=head3 C<MainLock>
my $bolSuccess = $object->MainLock();
my $bolSuccess = $object->MainLock(1);
Checks if a lock file exists and creates it if not. Fails if file exists and process stored within is alive.
If a C<true> value is supplied, locking is non-exclusive but shared. If the file exists and was also created non-exclusively, locking is successful. This way the lock file is shared with several processes, requesting non-exclusive mode.
If C<false> is returned from C<MainLock> no lock file was created/claimed.
Meaning:
____________________________________________________________________________________________________________________________________
| Call mode | MainLock() | MainLock() | MainLock() | MainLock() | MainLock(1) | MainLock(1) | MainLock(1) | MainLock(1) |
| Lock file | empty* | shared | exclusive | non-existent | empty* | shared | exclusive | non-existent |
| MainLock returns | false | false | false | true | false | true | false | true |
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯Â...
lib/IPC/LockTicket.pm view on Meta::CPAN
return(true);
}
sub _CleanAgentsList (\@) {
my $areList = shift;
my %bolTestedParent = ();
local $SIG{CLD} = q{IGNORE};
local $SIG{CHLD} = q{IGNORE};
# if parent was not tested yet test if alive, but we don't test ourself, but any other agent
return(grep { ( $bolTestedParent{$_->{_pidParent}}++ || kill(0 => $_->{_pidParent}) ) && ( $_->{_pidAgent} == $$ || kill(0 => $_->{_pidAgent}) ) } @{$areList});
}
=head3 C<TokenLock>
$object->TokenLock();
Can only be called after C<MainLock> and before C<MainUnlock> otherwise C<die>s.
Requests exclusive lock, i.e., any C<TokenLock> is blocking until C<TokenUnlock> was called, or the locking process is dead. Process checks are done to prevent infinite locks through broken children or parents, but this is not proper usage. Don't jus...
Returns a true value or blocks.
( run in 0.527 second using v1.01-cache-2.11-cpan-39bf76dae61 )