src/php/Arbit/Periodic/Executor.php
protected function aquireLock()
    {
        $lockfile = $this->lockDir . '/lock';
        // Silence call, since PHP will issue a warning when the file exists.
        // But there is no other way to properly immediately create a lock file
        // only if it does not exist yet.
        $fp = @fopen( $lockfile, 'x' );

        if ( $fp === false )
        {
            // Aquiring the lock failed.
            $this->logger->log(
                sprintf(
                    'The lockfile %s does already exist.',
                    $lockfile
                ),
                Logger::WARNING
            );
            return false;
        }

        // Store the lock aquiring time in the lock file so this can be
        // debugged more easily and maybe automotically released after
        // stallement.
        fwrite( $fp, time() );
        fclose( $fp );

        $this->logger->log( 'Aquired lock.', Logger::INFO );
        return true;
    }
protected function aquireLock()
    {
        $lockfile = $this->lockDir . '/lock';
        // Silence call, since PHP will issue a warning when the file exists.
        // But there is no other way to properly immediately create a lock file
        // only if it does not exist yet.
        $fp = @fopen( $lockfile, 'x' );

        if ( $fp === false )
        {
            // Aquiring the lock failed.
            $this->logger->log(
                sprintf(
                    'The lockfile %s does already exist.',
                    $lockfile
                ),
                Logger::WARNING
            );
            return false;
        }

        // Store the lock aquiring time in the lock file so this can be
        // debugged more easily and maybe automotically released after
        // stallement.
        fwrite( $fp, time() );
        fclose( $fp );

        $this->logger->log( 'Aquired lock.', Logger::INFO );
        return true;
    }
Try to aquire lock

Try to aquire lock - if successful the method will return true - and
false otherwise.

@return bool