def register sock, events = XS::POLLIN | XS::POLLOUT, fd = 0
      return false if (sock.nil? && fd.zero?) || events.zero?

      item = @items.get(@sockets.index(sock))

      unless item
        @sockets << sock
        item = LibXS::PollItem.new
        if sock.kind_of?(XS::Socket) || sock.kind_of?(Socket)
          item[:socket] = sock.socket
          item[:fd] = 0
        else
          item[:socket] = FFI::MemoryPointer.new(0)
          item[:fd] = fd
        end

        @raw_to_socket[item.socket.address] = sock
        @items << item
      end

      item[:events] |= events
    end
def register sock, events = XS::POLLIN | XS::POLLOUT, fd = 0
      return false if (sock.nil? && fd.zero?) || events.zero?

      item = @items.get(@sockets.index(sock))

      unless item
        @sockets << sock
        item = LibXS::PollItem.new
        if sock.kind_of?(XS::Socket) || sock.kind_of?(Socket)
          item[:socket] = sock.socket
          item[:fd] = 0
        else
          item[:socket] = FFI::MemoryPointer.new(0)
          item[:fd] = fd
        end

        @raw_to_socket[item.socket.address] = sock
        @items << item
      end

      item[:events] |= events
    end
Register the +sock+ for +events+. This method is idempotent meaning
 it can be called multiple times with the same data and the socket
 will only get registered at most once. Calling multiple times with
 different values for +events+ will OR the event information together.

 @param socket
 @param events
   One of @XS::POLLIN@ and @XS::POLLOUT@

 @return true if successful
 @return false if not