You are here

function queue in Lockr 7.3

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\queue()->run(); } </code>

Parameters

TaskQueueInterface $assign Optionally specify a new queue instance.:

Return value

TaskQueueInterface

3 calls to 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.
task in vendor/guzzlehttp/promises/src/functions.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/functions.php, line 21

Namespace

GuzzleHttp\Promise

Code

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