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

Breadcrumb

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

interface Suspension

Should be used to run and suspend the event loop instead of directly interacting with fibers.

**Example**

```php $suspension = EventLoop::getSuspension();

$promise->then( fn (mixed $value) => $suspension->resume($value), fn (Throwable $error) => $suspension->throw($error) );

$suspension->suspend(); ```

@template T

Hierarchy

  • interface \Revolt\EventLoop\Suspension

Expanded class hierarchy of Suspension

All classes that implement Suspension

4 files declare their use of Suspension
AbstractDriver.php in vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php
DriverSuspension.php in vendor/revolt/event-loop/src/EventLoop/Internal/DriverSuspension.php
EventLoop.php in vendor/revolt/event-loop/src/EventLoop.php
TracingDriver.php in vendor/revolt/event-loop/src/EventLoop/Driver/TracingDriver.php

File

vendor/revolt/event-loop/src/EventLoop/Suspension.php, line 25

Namespace

Revolt\EventLoop
View source
interface Suspension {
    
    /**
     * @param T $value The value to return from the call to {@see suspend()}.
     */
    public function resume(mixed $value = null) : void;
    
    /**
     * Returns the value provided to {@see resume()} or throws the exception provided to {@see throw()}.
     *
     * @return T
     */
    public function suspend() : mixed;
    
    /**
     * Throws the given exception from the call to {@see suspend()}.
     */
    public function throw(\Throwable $throwable) : void;

}

Members

Title Sort descending Modifiers Object type Summary Overrides
Suspension::resume public function 1
Suspension::suspend public function Returns the value provided to { 1
Suspension::throw public function Throws the given exception from the call to { 1

API Navigation

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