Dolda2000 GitWeb
/
jagi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
aac2f97
)
Use -1 from Watcher.events() to signal closure, rather than 0.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Mon, 14 Feb 2022 16:34:47 +0000
(17:34 +0100)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Mon, 14 Feb 2022 16:34:47 +0000
(17:34 +0100)
src/jagi/event/Driver.java
patch
|
blob
|
blame
|
history
diff --git
a/src/jagi/event/Driver.java
b/src/jagi/event/Driver.java
index
c9ca638
..
84238d2
100644
(file)
--- a/
src/jagi/event/Driver.java
+++ b/
src/jagi/event/Driver.java
@@
-138,7
+138,7
@@
public class Driver {
int evs = w.events();
double timeout = w.timeout();
boolean hastime = timeout < Double.POSITIVE_INFINITY;
int evs = w.events();
double timeout = w.timeout();
boolean hastime = timeout < Double.POSITIVE_INFINITY;
- if(
(evs == 0) && !hastime
) {
+ if(
evs < 0
) {
remove(w);
return;
}
remove(w);
return;
}
@@
-154,10
+154,11
@@
public class Driver {
int evs = w.events();
double timeout = w.timeout();
boolean hastime = timeout < Double.POSITIVE_INFINITY;
int evs = w.events();
double timeout = w.timeout();
boolean hastime = timeout < Double.POSITIVE_INFINITY;
- if(
(evs == 0) && !hastime
) {
-
w.close(
);
+ if(
evs < 0
) {
+
submit(w::close
);
return;
}
return;
}
+ w.added(Driver.this);
try {
watching.put(w, ch.register(poll, evs, w));
} catch(ClosedChannelException e) {
try {
watching.put(w, ch.register(poll, evs, w));
} catch(ClosedChannelException e) {
@@
-178,7
+179,7
@@
public class Driver {
throw(new RuntimeException(w + ": inconsistent internal state"));
if(wc == null)
throw(new IllegalStateException(w + ": not registered"));
throw(new RuntimeException(w + ": inconsistent internal state"));
if(wc == null)
throw(new IllegalStateException(w + ": not registered"));
-
w.close(
);
+
submit(w::close
);
poll.wakeup();
}
poll.wakeup();
}
@@
-189,7
+190,7
@@
public class Driver {
int evs = w.events();
double timeout = w.timeout();
boolean hastime = timeout < Double.POSITIVE_INFINITY;
int evs = w.events();
double timeout = w.timeout();
boolean hastime = timeout < Double.POSITIVE_INFINITY;
- if(
(evs == 0) && !hastime
) {
+ if(
evs < 0
) {
remove(w);
return;
}
remove(w);
return;
}