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.');
        }
    }