Exemple #1
0
 /**
  * @return \Icicle\Loop\LoopInterface
  *
  * @codeCoverageIgnore
  */
 function create() : LoopInterface
 {
     if (EventLoop::enabled()) {
         return new EventLoop();
     }
     if (LibeventLoop::enabled()) {
         return new LibeventLoop();
     }
     return new SelectLoop();
 }
Exemple #2
0
 /**
  * @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()
Exemple #4
0
 /**
  * SyncWrapper constructor.
  * @param $obj
  */
 public function __construct($cb)
 {
     EventLoop::$instance || EventLoop::init();
     $this->obj = $cb($this);
 }
Exemple #5
0
 public function cancel()
 {
     $this->loop->cancelTimer($this);
 }
Exemple #6
0
 public function cancel()
 {
     $this->loop->cancelSignal($this);
 }
Exemple #7
0
 public function cancel()
 {
     $this->loop->cancelChild($this);
 }