}
void handle(Watcher w, int evs) {
+ if(!watching.containsKey(w))
+ return;
try {
pause(w);
submit(() -> {
boolean quit = false;
Throwable error = null;
try {
+ double now = time();
while(true) {
- double now = time();
long timeout = 0;
synchronized(selectors) {
Double first = timeheap.keypeek();
}
for(SelectionKey key : poll.selectedKeys())
handle((Watcher)key.attachment(), key.readyOps());
+ now = time();
+ while(true) {
+ Double first = timeheap.keypeek();
+ if((first == null) || (first > now))
+ break;
+ handle(timeheap.remove(), 0);
+ }
}
} catch(Throwable t) {
error = t;