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

Breadcrumb

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

function AbstractDriver::getSuspension

Overrides Driver::getSuspension

File

vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php, line 288

Class

AbstractDriver
Event loop driver which implements all basic operations to allow interoperability.

Namespace

Revolt\EventLoop\Internal

Code

public function getSuspension() : Suspension {
    $fiber = \Fiber::getCurrent();
    // User callbacks are always executed outside the event loop fiber, so this should always be false.
    \assert($fiber !== $this->fiber);
    // Use queue closure in case of {main}, which can be unset by DriverSuspension after an uncaught exception.
    $key = $fiber ?? $this->queueCallback;
    $suspension = ($this->suspensions[$key] ?? null)?->get();
    if ($suspension) {
        return $suspension;
    }
    $suspension = new DriverSuspension($this->runCallback, $this->queueCallback, $this->interruptCallback, $this->suspensions);
    $this->suspensions[$key] = \WeakReference::create($suspension);
    return $suspension;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal