Icicle\Concurrent\Forking\Fork::setPriority PHP Method

setPriority() public method

Note that on many systems, only the superuser can increase the priority of a process.
See also: Fork::getPriority()
public setPriority ( float $priority ) : float
$priority float A priority value between 0 and 1.
return float
    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.');
        }
    }