1
0
mirror of https://github.com/danog/amp.git synced 2024-11-27 12:35:02 +01:00

Merge pull request #55 from async-interop/info

Add Loop::info
This commit is contained in:
Andrew Carter 2016-05-23 23:10:35 +01:00
commit 6c531f59d7
2 changed files with 49 additions and 0 deletions

View File

@ -274,6 +274,32 @@ final class Loop
self::get()->setErrorHandler($callback);
}
/**
* Retrieve an associative array of information about the event loop driver.
*
* The returned array MUST contain the following data describing the driver's
* currently registered watchers:
*
* [
* "defer" => ["enabled" => int, "disabled" => int],
* "delay" => ["enabled" => int, "disabled" => int],
* "repeat" => ["enabled" => int, "disabled" => int],
* "on_readable" => ["enabled" => int, "disabled" => int],
* "on_writable" => ["enabled" => int, "disabled" => int],
* "on_signal" => ["enabled" => int, "disabled" => int],
* "watchers" => ["referenced" => int, "unreferenced" => int],
* ];
*
* Implementations MAY optionally add more information in the array but
* at minimum the above key => value format MUST always be provided.
*
* @return array
*/
public static function info()
{
return self::get()->info();
}
/**
* Disable construction as this is a static class.
*/

View File

@ -144,6 +144,29 @@ interface LoopDriver
*/
public function setErrorHandler(callable $callback = null);
/**
* Retrieve an associative array of information about the event loop driver.
*
* The returned array MUST contain the following data describing the driver's
* currently registered watchers:
*
* [
* "defer" => ["enabled" => int, "disabled" => int],
* "delay" => ["enabled" => int, "disabled" => int],
* "repeat" => ["enabled" => int, "disabled" => int],
* "on_readable" => ["enabled" => int, "disabled" => int],
* "on_writable" => ["enabled" => int, "disabled" => int],
* "on_signal" => ["enabled" => int, "disabled" => int],
* "watchers" => ["referenced" => int, "unreferenced" => int],
* ];
*
* Implementations MAY optionally add more information in the array but
* at minimum the above key => value format MUST always be provided.
*
* @return array
*/
public function info();
/**
* Get the underlying loop handle.
*