/** * @return \Icicle\Loop\LoopInterface * * @codeCoverageIgnore */ function create() : LoopInterface { if (EventLoop::enabled()) { return new EventLoop(); } if (LibeventLoop::enabled()) { return new LibeventLoop(); } return new SelectLoop(); }
/** * @param bool $enableSignals True to enable signal handling, false to disable. * * @return \Icicle\Loop\Loop * * @codeCoverageIgnore */ function create(bool $enableSignals = true) : Loop { if (UvLoop::enabled()) { return new UvLoop($enableSignals); } if (EvLoop::enabled()) { return new EvLoop($enableSignals); } if (EventLoop::enabled()) { return new EventLoop($enableSignals); } if (LibeventLoop::enabled()) { return new LibeventLoop($enableSignals); } return new SelectLoop($enableSignals); }
/** * Created by PhpStorm. * User: ovr * Date: 06.12.15 * Time: 22:26 */ use Lavoiesl\PhpBenchmark\Benchmark; use Ovr\Bench\AssignOrNot\ReturnAfterAssignProperty; use Ovr\Bench\AssignOrNot\ReturnWithoutAfterAssignProperty; include_once __DIR__ . '/vendor/autoload.php'; $benchmark = new Benchmark(); class EventLoop { public static $instance; } EventLoop::$instance = new EventLoop(); class A { protected $ev; public function __construct(EventLoop $ev) { $this->ev = $ev; } public function test() { return $this->ev; } } class B { public function test()
/** * SyncWrapper constructor. * @param $obj */ public function __construct($cb) { EventLoop::$instance || EventLoop::init(); $this->obj = $cb($this); }
public function cancel() { $this->loop->cancelTimer($this); }
public function cancel() { $this->loop->cancelSignal($this); }
public function cancel() { $this->loop->cancelChild($this); }