diff --git a/src/Loop.php b/src/Loop.php index 1990697..f65a9db 100644 --- a/src/Loop.php +++ b/src/Loop.php @@ -422,6 +422,19 @@ public static function getInfo() return $driver->getInfo(); } + /** + * Get the underlying loop handle. + * + * Example: the `uv_loop` resource for `libuv` or the `EvLoop` object for `libev` or `null` for a native driver. + * + * @return null|object|resource The loop handle the event loop operates on. `null` if there is none. + */ + public static function getHandle() + { + $driver = self::$driver ?: self::get(); + return $driver->getHandle(); + } + /** * Disable construction as this is a static class. */ diff --git a/src/Loop/Driver.php b/src/Loop/Driver.php index 50041f1..c1e7b15 100644 --- a/src/Loop/Driver.php +++ b/src/Loop/Driver.php @@ -277,9 +277,6 @@ abstract public function getInfo(); * * Example: the `uv_loop` resource for `libuv` or the `EvLoop` object for `libev` or `null` for a native driver. * - * Note: This function is *not* exposed in the `Loop` class. Users shall access it directly on the respective loop - * instance. - * * @return null|object|resource The loop handle the event loop operates on. `null` if there is none. */ abstract public function getHandle();