< prev index next >
src/java.base/unix/classes/sun/nio/ch/PollSelectorImpl.java
Print this page
*** 40,50 ****
/**
* Selector implementation based on poll
*/
! class PollSelectorImpl extends SelectorImpl {
// initial capacity of poll array
private static final int INITIAL_CAPACITY = 16;
// poll array, grows as needed
--- 40,50 ----
/**
* Selector implementation based on poll
*/
! public class PollSelectorImpl extends SelectorImpl {
// initial capacity of poll array
private static final int INITIAL_CAPACITY = 16;
// poll array, grows as needed
*** 65,75 ****
// interrupt triggering and clearing
private final Object interruptLock = new Object();
private boolean interruptTriggered;
! PollSelectorImpl(SelectorProvider sp) throws IOException {
super(sp);
int size = pollArrayCapacity * SIZE_POLLFD;
this.pollArray = new AllocatedNativeObject(size, false);
--- 65,75 ----
// interrupt triggering and clearing
private final Object interruptLock = new Object();
private boolean interruptTriggered;
! protected PollSelectorImpl(SelectorProvider sp) throws IOException {
super(sp);
int size = pollArrayCapacity * SIZE_POLLFD;
this.pollArray = new AllocatedNativeObject(size, false);
*** 131,140 ****
--- 131,148 ----
processDeregisterQueue();
return processEvents(action);
}
/**
+ * Protected poll method allows different platform-specific
+ * native implementations
+ */
+ protected int poll(long pollAddress, int numfds, int timeout) {
+ return poll0(pollAddress, numfds, timeout);
+ }
+
+ /**
* Process changes to the interest ops.
*/
private void processUpdateQueue() {
assert Thread.holdsLock(this);
*** 375,385 ****
private int getReventOps(int i) {
int offset = SIZE_POLLFD * i + REVENT_OFFSET;
return pollArray.getShort(offset);
}
! private static native int poll(long pollAddress, int numfds, int timeout);
static {
IOUtil.load();
}
}
--- 383,393 ----
private int getReventOps(int i) {
int offset = SIZE_POLLFD * i + REVENT_OFFSET;
return pollArray.getShort(offset);
}
! private static native int poll0(long pollAddress, int numfds, int timeout);
static {
IOUtil.load();
}
}
< prev index next >