コード例 #1
0
  public int select(int nfds, FDSet rfds, FDSet wfds, FDSet efds, TimeVal timeout) {
    timeval tout = null;
    if (timeout != null) {
      tout = new timeval(timeout);
    }

    return m_ClibND.select(nfds, (fd_set) rfds, (fd_set) wfds, (fd_set) efds, tout);
  }
コード例 #2
0
 public int poll(Pollfd fds[], int nfds, int timeout) {
   if (nfds <= 0 || nfds > fds.length) {
     throw new java.lang.IllegalArgumentException(
         "nfds " + nfds + " must be <= fds.length " + fds.length);
   }
   pollfd.ByReference parampfds = new pollfd.ByReference();
   pollfd[] pfds = (pollfd[]) parampfds.toArray(nfds);
   for (int i = 0; i < nfds; i++) {
     pfds[i].fd = fds[i].fd;
     pfds[i].events = fds[i].events;
   }
   int ret = m_ClibND.poll(parampfds, nfds, timeout);
   for (int i = 0; i < nfds; i++) {
     fds[i].revents = pfds[i].revents;
   }
   return ret;
 }