// Process all events currently stored in the control queue. private void processControlQueue() { synchronized (controlQueue) { // On Aix it is only possible to set the event // bits on the first call of pollsetCtl. Later // calls only add bits, but cannot remove them. // Therefore, we always remove the file // descriptor ignoring the error and then add it. Iterator<ControlEvent> iter = controlQueue.iterator(); while (iter.hasNext()) { ControlEvent ev = iter.next(); pollsetCtl(pollset, PS_DELETE, ev.fd(), 0); if (!ev.removeOnly()) { ev.setError(pollsetCtl(pollset, PS_MOD, ev.fd(), ev.events())); } iter.remove(); } controlQueue.notifyAll(); } }