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

Breadcrumb

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

function TimerQueue::insert

Inserts the callback into the queue.

Time complexity: O(log(n)).

File

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

Class

TimerQueue
Uses a binary tree stored in an array to implement a heap.

Namespace

Revolt\EventLoop\Internal

Code

public function insert(TimerCallback $callback) : void {
    \assert(!isset($this->pointers[$callback->id]));
    $node = \count($this->callbacks);
    $this->callbacks[$node] = $callback;
    $this->pointers[$callback->id] = $node;
    $this->heapifyUp($node);
}

API Navigation

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