public function initialize()
    {
        if ($this->isActive()) {
            throw new RuntimeException('Process is already active');
        }

        $handle = $this->getFileResource();

        if (! @flock($handle, (LOCK_EX | LOCK_NB))) {
            throw new RuntimeException('Could not lock pidfile');
        }

        if (-1 === @fseek($handle, 0)) {
            throw new RuntimeException('Could not seek pidfile cursor');
        }

        if (! @ftruncate($handle, 0)) {
            throw new RuntimeException('Could not truncate pidfile');
        }

        if (! @fwrite($handle, $this->control->info()->getId().PHP_EOL)) {
            throw new RuntimeException('Could not write on pidfile');
        }
    }
public function initialize()
    {
        if ($this->isActive()) {
            throw new RuntimeException('Process is already active');
        }

        $handle = $this->getFileResource();

        if (! @flock($handle, (LOCK_EX | LOCK_NB))) {
            throw new RuntimeException('Could not lock pidfile');
        }

        if (-1 === @fseek($handle, 0)) {
            throw new RuntimeException('Could not seek pidfile cursor');
        }

        if (! @ftruncate($handle, 0)) {
            throw new RuntimeException('Could not truncate pidfile');
        }

        if (! @fwrite($handle, $this->control->info()->getId().PHP_EOL)) {
            throw new RuntimeException('Could not write on pidfile');
        }
    }
public function initialize ( ) { if ( $ this -> isActive ( ) ) { throw new RuntimeException ( 'Process is already active' ) ; } $ handle = $ this -> getFileResource ( ) ; if ( ! @ flock ( $ handle , ( LOCK_EX | LOCK_NB ) ) ) { throw new RuntimeException ( 'Could not lock pidfile' ) ; } if ( - 1 === @ fseek ( $ handle , 0 ) ) { throw new RuntimeException ( 'Could not seek pidfile cursor' ) ; } if ( ! @ ftruncate ( $ handle , 0 ) ) { throw new RuntimeException ( 'Could not truncate pidfile' ) ; } if ( ! @ fwrite ( $ handle , $ this -> control -> info ( ) -> getId ( ) . PHP_EOL ) ) { throw new RuntimeException ( 'Could not write on pidfile' ) ; } }
Initializes pidfile.

Create an empty file, store the PID into the file and lock it.
Initializes pidfile .