diff --git a/src/Events/Event.php b/src/Events/Event.php index 51fcead3..33d59f6d 100644 --- a/src/Events/Event.php +++ b/src/Events/Event.php @@ -140,7 +140,7 @@ public function repeat(float $interval, callable $func, array $args = []): int { $className = $this->eventClassName; $timerId = $this->timerId++; - $event = new $className($this->eventBase, -1, $className::TIMEOUT | $className::PERSIST, fn () => $this->safeCall($func, $args)); + $event = new $className($this->eventBase, -1, $className::TIMEOUT | $className::PERSIST, $func); if (!$event->addTimer($interval)) { throw new \RuntimeException("Event::addTimer($interval) failed"); } @@ -155,7 +155,7 @@ public function onReadable($stream, callable $func): void { $className = $this->eventClassName; $fdKey = (int)$stream; - $event = new $className($this->eventBase, $stream, $className::READ | $className::PERSIST, fn () => $this->safeCall($func, [$stream])); + $event = new $className($this->eventBase, $stream, $className::READ | $className::PERSIST, $func); if ($event->add()) { $this->readEvents[$fdKey] = $event; } @@ -182,7 +182,7 @@ public function onWritable($stream, callable $func): void { $className = $this->eventClassName; $fdKey = (int)$stream; - $event = new $className($this->eventBase, $stream, $className::WRITE | $className::PERSIST, fn () => $this->safeCall($func, [$stream])); + $event = new $className($this->eventBase, $stream, $className::WRITE | $className::PERSIST, $func); if ($event->add()) { $this->writeEvents[$fdKey] = $event; } diff --git a/src/Events/Select.php b/src/Events/Select.php index 0bd0c24a..95f2fa77 100644 --- a/src/Events/Select.php +++ b/src/Events/Select.php @@ -381,21 +381,21 @@ public function run(): void foreach ($read as $fd) { $fdKey = (int)$fd; if (isset($this->readEvents[$fdKey])) { - $this->safeCall($this->readEvents[$fdKey], [$fd]); + $this->readEvents[$fdKey]($fd); } } foreach ($write as $fd) { $fdKey = (int)$fd; if (isset($this->writeEvents[$fdKey])) { - $this->safeCall($this->writeEvents[$fdKey], [$fd]); + $this->writeEvents[$fdKey]($fd); } } foreach ($except as $fd) { $fdKey = (int)$fd; if (isset($this->exceptEvents[$fdKey])) { - $this->safeCall($this->exceptEvents[$fdKey], [$fd]); + $this->exceptEvents[$fdKey]($fd); } }