Skip to content

Commit d03a2c1

Browse files
committed
Add getLoopHandle() for accessing the underlying loop
These resources or objects may then be attributed to a specific extension via instanceof or get_resource_type() in implementations. Fixes #16.
1 parent 30fc546 commit d03a2c1

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/Loop.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,15 @@ public static function supports($feature) {
222222
return self::get()->supports($feature);
223223
}
224224

225+
/**
226+
* Get the underlying loop handle.
227+
*
228+
* @return null|object|resource The loop handle the event loop operates on. Null if there is none.
229+
*/
230+
public static function getLoopHandle() {
231+
return self::get()->getLoopHandle();
232+
}
233+
225234
/**
226235
* Disable construction as this is a static class.
227236
*/

src/LoopDriver.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,13 @@ public function unreference($eventIdentifier);
151151
* @return bool
152152
*/
153153
public function supports($feature);
154+
155+
/**
156+
* Get the underlying loop handle.
157+
*
158+
* Example: the uv_loop resource for libuv or the EvLoop object for libev or null for a native driver
159+
*
160+
* @return null|object|resource The loop handle the event loop operates on. Null if there is none.
161+
*/
162+
public static function getLoopHandle();
154163
}

0 commit comments

Comments
 (0)