From 2843dbf1f33f3da2db6a4d01f49fae2bced409f4 Mon Sep 17 00:00:00 2001 From: Andrew Carter Date: Tue, 1 Mar 2016 00:52:59 +0000 Subject: [PATCH] Updated with response from discussions on issues --- src/EventLoopInterface.php | 72 ++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/src/EventLoopInterface.php b/src/EventLoopInterface.php index 124ff8d..1bc2e1b 100644 --- a/src/EventLoopInterface.php +++ b/src/EventLoopInterface.php @@ -12,45 +12,55 @@ interface EventLoopInterface /** * @return void */ - public function tick(bool $block = true); + public function stop(); + + /** + * @return string + */ + public function defer(callable $callback); + + /** + * @return string + */ + public function delay(callable $callback, float $time); + + /** + * @return string + */ + public function repeat(callable $callback, float $interval); + + /** + * @return string + */ + public function onReadable($stream, callable $callback); + + /** + * @return string + */ + public function onWritable($stream, callable $callback); + + /** + * @return string + */ + public function onSignal(int $signo, callable $callback); + + /** + * @return string + */ + public function onError(callable $callback); /** * @return void */ - public function stop(); + public function enable(string $watcherId); /** - * @return WatcherInterface + * @return void */ - public function queue(callable $callback, ...$args); + public function disable(string $watcherId); /** - * @return WatcherInterface + * @return void */ - public function once(callable $callback, float $time, $data = null); - - /** - * @return WatcherInterface - */ - public function repeat(callable $callback, float $interval, $data = null); - - /** - * @return WatcherInterface - */ - public function onReadable($stream, callable $callback, $data = null); - - /** - * @return WatcherInterface - */ - public function onWritable($stream, callable $callback, $data = null); - - /** - * @return WatcherInterface - */ - public function onSignal(int $signo, callable $callback, $data = null); - - /** - * @return WatcherInterface - */ - public function onError(callable $callback); + public function cancel(string $watcherId); }