Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Loop::getHandle #121

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/Loop.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
3 changes: 0 additions & 3 deletions src/Loop/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down