コード例 #1
0
ファイル: SocketManager.php プロジェクト: kanzuka/icicle
 /**
  * {@inheritdoc}
  */
 public function create($resource, callable $callback) : SocketEventInterface
 {
     $id = (int) $resource;
     if (isset($this->sockets[$id])) {
         throw new ResourceBusyError('A socket event has already been created for this resource.');
     }
     return $this->sockets[$id] = $this->factory->socket($this, $resource, $callback);
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function create($resource, callable $callback) : SocketEventInterface
 {
     $id = (int) $resource;
     if (isset($this->events[$id])) {
         throw new ResourceBusyError('A poll has already been created for that resource.');
     }
     $socket = $this->factory->socket($this, $resource, $callback);
     $event = $this->loop->io($resource, $this->type, $this->socketCallback, $socket);
     $event->stop();
     $this->events[$id] = $event;
     return $socket;
 }