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

Breadcrumb

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

function Driver::onReadable

Execute a callback when a stream resource becomes readable or is closed for reading.

Warning: Closing resources locally, e.g. with `fclose`, might not invoke the callback. Be sure to `cancel` the callback when closing the resource locally. Drivers MAY choose to notify the user if there are callbacks on invalid resources, but are not required to, due to the high performance impact. Callbacks on closed resources are therefore undefined behavior.

Multiple callbacks on the same stream MAY be executed in any order.

The created callback MUST immediately be marked as enabled, but only be activated (i.e. callback can be called) right before the next tick. Callbacks MUST NOT be called in the tick they were enabled.

Parameters

resource $stream The stream to monitor.:

\Closure(string, resource):void $closure The callback to execute.:

Return value

string A unique identifier that can be used to cancel, enable or disable the callback.

2 methods override Driver::onReadable()
AbstractDriver::onReadable in vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php
Execute a callback when a stream resource becomes readable or is closed for reading.
TracingDriver::onReadable in vendor/revolt/event-loop/src/EventLoop/Driver/TracingDriver.php
Execute a callback when a stream resource becomes readable or is closed for reading.

File

vendor/revolt/event-loop/src/EventLoop/Driver.php, line 134

Class

Driver
The driver MUST run in its own fiber and execute callbacks in a separate fiber. If fibers are reused, the driver needs to call {

Namespace

Revolt\EventLoop

Code

public function onReadable(mixed $stream, \Closure $closure) : string;

API Navigation

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