protected function createSignalCallback(): callable
    {
        return function ($signo) {
            $handled = false;

            if (isset($this->signals[$signo])) {
                foreach ($this->signals[$signo] as $signal) {
                    $handled = true;
                    $signal->call();
                }
            }

            switch ($signo) {
                case SIGHUP:
                case SIGINT:
                case SIGQUIT:
                case SIGABRT:
                case SIGTRAP:
                case SIGXCPU:
                    if (!$handled) {
                        $this->loop->stop();
                    }
                    break;

                case SIGTERM:
                case SIGBUS:
                case SIGSEGV:
                case SIGFPE:
                    $this->loop->stop();
                    break;
            }
        };
    }