++ed by:
ILUX ZMUGHAL ADAMJS

3 PAUSE users
7 non-PAUSE users.

Author image Marty O'Brien

NAME

Forks::Super::Sync::Semaphlock - Forks::Super sync object using advisory file locking

SYNOPSIS

    $lock = Forks::Super::Sync->new(implementation => 'Semaphlock', ...);

    $pid=fork();
    $lock->releaseAfterFork();

    if ($pid == 0) { # child code
       $lock->acquire(...);
       $lock->release(...);
    } else {
       $lock->acquire(...);
       $lock->release(...);
    }

DESCRIPTION

IPC synchronization object implemented with advisory file locking. Useful as a last resort if your system does not have good support for semaphores or shared memory.

Advantages: should work anywhere that implements "flock" in perlfunc.

Disadvantages: creates files, IPC litter. Uses precious filehandles.

SEE ALSO

Forks::Super::Sync