public function start($clearstack = true)
    {
        $pid = \pcntl_fork();

        if ($pid === -1) {
            throw new \Exception('Could not fork');
        } elseif ($pid === 0) { // we are the child
            $thread = $this;
            $thread->pid = \posix_getpid();
            if (!$thread->delayedSigReg) {
                $thread->registerSignals();
            }
            if ($clearstack) {
                throw new ClearStack('', 0, $thread);
            } else {
                $thread->run();
                $thread->shutdown();
            }
        } else { // we are the master
            $this->pid = $pid;
        }
    }