*/ private readonly array $watchers; private readonly Cancellation $cancellation; /** * @param int|int[] $signals Signal number or array of signal numbers. * @param string $message Message for SignalException. Default is "Operation cancelled by signal". */ public function __construct(int|array $signals, string $message = "Operation cancelled by signal") { if (\is_int($signals)) { $signals = [$signals]; } $this->cancellation = $source = new Internal\Cancellable; $trace = null; // Defined in case assertions are disabled. \assert((bool) ($trace = \debug_backtrace(0))); $watchers = []; $callback = static function () use (&$watchers, $source, $message, $trace): void { foreach ($watchers as $watcher) { EventLoop::cancel($watcher); } if ($trace) { $message .= \sprintf("\r\n%s was created here: %s", self::class, Internal\formatStacktrace($trace)); } else { $message .= \sprintf(" (Enable assertions for a backtrace of the %s creation)", self::class); } $source->cancel(new SignalException($message)); }; foreach ($signals as $signal) { $watchers[] = EventLoop::unreference(EventLoop::onSignal($signal, $callback)); } $this->watchers = $watchers; } /** * Cancels the delay watcher. */ public function __destruct() { foreach ($this->watchers as $watcher) { EventLoop::cancel($watcher); } } public function subscribe(\Closure $callback): string { return $this->cancellation->subscribe($callback); } public function unsubscribe(string $id): void { $this->cancellation->unsubscribe($id); } public function isRequested(): bool { return $this->cancellation->isRequested(); } public function throwIfRequested(): void { $this->cancellation->throwIfRequested(); } } __halt_compiler();----SIGNATURE:----J/vLkZnBRGDeLtSUISWs77yzfNThOuIoRlOn2/NaC9mfyaKqDwFGGnDQmNEe3kV+MYYSPu1cxH+YOTUS2Va/GNlrZWkyABPQYey1iYSwVAfAOFF0Hktf1FkWu/eBTYRs3hYOcqTFYqgTkeJZgZZUFnWRdJyAPeYzX/craHfV9p/qdTDHjKfKNCukcHEJTza49OHkLu68qfUXkxGcCCeQqAIL1x4rKTHWPv+VPlIpCNSmgSf4gsKBbjQngzIpXyAJhwN7aEVkyWv/2KM0Xk92Eu2CGvj72VcaaIc0S0wquQi2NN2MteUGGCuU9s1WoOGu4+6/LB+CwnyTfE35yV8cmQ+vmjwXlmTicfDjnqJdyBcOiXHk6EJc+wqVAorpP826nPMHOhudrvJLaaCVe5tA5xD1O48gQQ8iFoCx014UuXJx8bsZhJI+b2gIBChTb2LsJbDi8dZRHoHhJLtiRITkS2IW2++3kJs+BeBtcQD2IXX2Gu2+clKiHmfgzmDjj6eAaJSSFOLvVctbquE6XiLd9WtWG5nySlIJHOEgV/vdQhe51jdoERH5HehaZ4JkNuKoURhYzHZbudCd0Uc97EhYa4G3BowU3daj4WvmIwa2YszxrYQGU0vVyNZwUtI7PqVSoUQ3b0ge8H3Sdda400Hfu5UCrBQvov7mw7ZkEemm9aI=----ATTACHMENT:----MzYzNzcwODM1NjEyNzc5NyAxNDE1MTU5MDMzNzQ4NzYzIDI5MzU4MDgzOTk4MTg3NDQ=