Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. UvDriver.php

function UvDriver::cancel

Overrides AbstractDriver::cancel

File

vendor/revolt/event-loop/src/EventLoop/Driver/UvDriver.php, line 86

Class

UvDriver

Namespace

Revolt\EventLoop\Driver

Code

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]);
}
RSS feed
Powered by Drupal