function UvDriver::cancel
Overrides AbstractDriver::cancel
File
-
vendor/
revolt/ event-loop/ src/ EventLoop/ Driver/ UvDriver.php, line 86
Class
Namespace
Revolt\EventLoop\DriverCode
public function cancel(string $callbackId) : void {
parent::cancel($callbackId);
if (!isset($this->events[$callbackId])) {
return;
}
$event = $this->events[$callbackId];
$eventId = (int) $event;
if (isset($this->uvCallbacks[$eventId][0])) {
// All except IO callbacks.
unset($this->uvCallbacks[$eventId]);
}
elseif (isset($this->uvCallbacks[$eventId][$callbackId])) {
$callback = $this->uvCallbacks[$eventId][$callbackId];
unset($this->uvCallbacks[$eventId][$callbackId]);
\assert($callback instanceof StreamCallback);
if (empty($this->uvCallbacks[$eventId])) {
unset($this->uvCallbacks[$eventId], $this->streams[(int) $callback->stream]);
}
}
unset($this->events[$callbackId]);
}