2016-01-20 12:01:40 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Interop\Async\EventLoop;
|
|
|
|
|
|
|
|
interface EventLoopInterface
|
|
|
|
{
|
2016-02-17 16:25:39 +01:00
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function run(callable $onStart = null);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
2016-03-01 01:52:59 +01:00
|
|
|
public function stop();
|
2016-02-17 16:25:39 +01:00
|
|
|
|
|
|
|
/**
|
2016-03-01 01:52:59 +01:00
|
|
|
* @return string
|
2016-02-17 16:25:39 +01:00
|
|
|
*/
|
2016-03-01 01:52:59 +01:00
|
|
|
public function defer(callable $callback);
|
2016-02-17 16:25:39 +01:00
|
|
|
|
|
|
|
/**
|
2016-03-01 01:52:59 +01:00
|
|
|
* @return string
|
2016-02-17 16:25:39 +01:00
|
|
|
*/
|
2016-03-01 01:52:59 +01:00
|
|
|
public function delay(callable $callback, float $time);
|
2016-02-17 16:25:39 +01:00
|
|
|
|
|
|
|
/**
|
2016-03-01 01:52:59 +01:00
|
|
|
* @return string
|
2016-02-17 16:25:39 +01:00
|
|
|
*/
|
2016-03-01 01:52:59 +01:00
|
|
|
public function repeat(callable $callback, float $interval);
|
2016-02-17 16:25:39 +01:00
|
|
|
|
|
|
|
/**
|
2016-03-01 01:52:59 +01:00
|
|
|
* @return string
|
2016-02-17 16:25:39 +01:00
|
|
|
*/
|
2016-03-01 01:52:59 +01:00
|
|
|
public function onReadable($stream, callable $callback);
|
2016-02-17 16:25:39 +01:00
|
|
|
|
|
|
|
/**
|
2016-03-01 01:52:59 +01:00
|
|
|
* @return string
|
2016-02-17 16:25:39 +01:00
|
|
|
*/
|
2016-03-01 01:52:59 +01:00
|
|
|
public function onWritable($stream, callable $callback);
|
2016-02-17 16:25:39 +01:00
|
|
|
|
|
|
|
/**
|
2016-03-01 01:52:59 +01:00
|
|
|
* @return string
|
2016-02-17 16:25:39 +01:00
|
|
|
*/
|
2016-03-01 01:52:59 +01:00
|
|
|
public function onSignal(int $signo, callable $callback);
|
2016-02-17 16:25:39 +01:00
|
|
|
|
|
|
|
/**
|
2016-03-01 01:52:59 +01:00
|
|
|
* @return string
|
2016-02-17 16:25:39 +01:00
|
|
|
*/
|
2016-03-01 01:52:59 +01:00
|
|
|
public function onError(callable $callback);
|
2016-02-17 16:25:39 +01:00
|
|
|
|
|
|
|
/**
|
2016-03-01 01:52:59 +01:00
|
|
|
* @return void
|
2016-02-17 16:25:39 +01:00
|
|
|
*/
|
2016-03-01 01:52:59 +01:00
|
|
|
public function enable(string $watcherId);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function disable(string $watcherId);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function cancel(string $watcherId);
|
2016-01-20 12:01:40 +01:00
|
|
|
}
|