JAXLLoop::watch PHP Method

watch() public static method

public static watch ( $fd, $opts )
    public static function watch($fd, $opts)
    {
        if (isset($opts['read'])) {
            $fdid = (int) $fd;
            self::$read_fds[$fdid] = $fd;
            self::$read_cbs[$fdid] = $opts['read'];
            ++self::$active_read_fds;
        }
        if (isset($opts['write'])) {
            $fdid = (int) $fd;
            self::$write_fds[$fdid] = $fd;
            self::$write_cbs[$fdid] = $opts['write'];
            ++self::$active_write_fds;
        }
        JAXLLogger::debug("Watch: active read fds: " . self::$active_read_fds . ", write fds: " . self::$active_write_fds);
    }

Usage Example

Ejemplo n.º 1
0
 public function __construct($recv_cb = null, $quit_cb = null)
 {
     $this->recv_cb = $recv_cb;
     $this->quit_cb = $quit_cb;
     // catch read event on stdin
     $this->in = fopen('php://stdin', 'r');
     stream_set_blocking($this->in, false);
     JAXLLoop::watch($this->in, array('read' => array(&$this, 'on_read_ready')));
 }
All Usage Examples Of JAXLLoop::watch