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

Breadcrumb

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

function Utils::queue

Get the global task queue used for promise resolution.

This task queue MUST be run in an event loop in order for promises to be settled asynchronously. It will be automatically run when synchronously waiting on a promise.

<code> while ($eventLoop->isRunning()) { GuzzleHttp\Promise\Utils::queue()->run(); } </code>

Parameters

TaskQueueInterface|null $assign Optionally specify a new queue instance.:

3 calls to Utils::queue()
FulfilledPromise::then in vendor/guzzlehttp/promises/src/FulfilledPromise.php
Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler.
RejectedPromise::then in vendor/guzzlehttp/promises/src/RejectedPromise.php
Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler.
Utils::task in vendor/guzzlehttp/promises/src/Utils.php
Adds a function to run in the task queue when it is next `run()` and returns a promise that is fulfilled or rejected with the result.

File

vendor/guzzlehttp/promises/src/Utils.php, line 24

Class

Utils

Namespace

GuzzleHttp\Promise

Code

public static function queue(?TaskQueueInterface $assign = null) : TaskQueueInterface {
    static $queue;
    if ($assign) {
        $queue = $assign;
    }
    elseif (!$queue) {
        $queue = new TaskQueue();
    }
    return $queue;
}

API Navigation

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