@Test public synchronized void testSelect() throws InterruptedException{ if(!isUnix()) return; final int[] pipefds = new int[2]; Unix.pipe(pipefds); Unix.write(pipefds[1], new byte[]{0}, 1); int[] readfds = new int[] {pipefds[0], pipefds[1]}; int selectresult = Unix.select(readfds, null, null, -1); assertEquals(selectresult, 1); Unix.close(pipefds[0]); Unix.close(pipefds[1]); }
native static int select(int[] readfds, int[] writefds, int[] exceptfds, long timeout);
Unix { native static int select(int[] readfds, int[] writefds, int[] exceptfds, long timeout); }
Unix { native static int select(int[] readfds, int[] writefds, int[] exceptfds, long timeout);  }
Unix { native static int select(int[] readfds, int[] writefds, int[] exceptfds, long timeout);   }
Unix { native static int select(int[] readfds, int[] writefds, int[] exceptfds, long timeout);    }