public function setPriority(float $priority): float
    {
        if ($priority < 0 || $priority > 1) {
            throw new InvalidArgumentError('Priority value must be between 0.0 and 1.0.');
        }

        $nice = round(19 - ($priority * 39));

        if (!pcntl_setpriority($nice, $this->pid, PRIO_PROCESS)) {
            throw new ForkException('Failed to set the fork\'s priority.');
        }
    }
public function setPriority(float $priority): float
    {
        if ($priority < 0 || $priority > 1) {
            throw new InvalidArgumentError('Priority value must be between 0.0 and 1.0.');
        }

        $nice = round(19 - ($priority * 39));

        if (!pcntl_setpriority($nice, $this->pid, PRIO_PROCESS)) {
            throw new ForkException('Failed to set the fork\'s priority.');
        }
    }
public function setPriority ( float $ priority ) : float { if ( $ priority < 0 || $ priority > 1 ) { throw new InvalidArgumentError ( 'Priority value must be between 0.0 and 1.0.' ) ; } $ nice = round ( 19 - ( $ priority * 39 ) ) ; if ( ! pcntl_setpriority ( $ nice , $ this -> pid , PRIO_PROCESS ) ) { throw new ForkException ( 'Failed to set the fork\'s priority.' ) ; } }
Sets the fork's scheduling priority as a percentage.

Note that on many systems, only the superuser can increase the priority of a process.

@param float $priority A priority value between 0 and 1.

@throws InvalidArgumentError If the given priority is an invalid value.
@throws ForkException        If the operation failed.

@see Fork::getPriority()
Sets the fork s scheduling priority as a percentage .