Commit c5fd8041 by Michael Koch Committed by Michael Koch

2003-09-25 Michael Koch <konqueror@gmx.de>

	* gnu/java/nio/SelectorImpl.java
	(implSelect): Renamed from java_do_select.
	(select): Call native implSelect() and add support for Thread
	interruption.
	* gnu/java/nio/natSelectorImpl.cc
	(implSelect): Renamed from java_do_select.

From-SVN: r71781
parent 465ad0c7
2003-09-25 Michael Koch <konqueror@gmx.de> 2003-09-25 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/SelectorImpl.java * gnu/java/nio/SelectorImpl.java
(implSelect): Renamed from java_do_select.
(select): Call native implSelect() and add support for Thread
interruption.
* gnu/java/nio/natSelectorImpl.cc
(implSelect): Renamed from java_do_select.
2003-09-25 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/SelectorImpl.java
(selectNow): Made final, throws IOException. (selectNow): Made final, throws IOException.
(select): Likewise. (select): Likewise.
(getFDsAsArray): Made final. (getFDsAsArray): Made final.
......
...@@ -93,7 +93,7 @@ public class SelectorImpl extends AbstractSelector ...@@ -93,7 +93,7 @@ public class SelectorImpl extends AbstractSelector
} }
// A timeout value of -1 means block forever. // A timeout value of -1 means block forever.
private static native int java_do_select (int[] read, int[] write, private static native int implSelect (int[] read, int[] write,
int[] except, long timeout); int[] except, long timeout);
private final int[] getFDsAsArray (int ops) private final int[] getFDsAsArray (int ops)
...@@ -143,18 +143,18 @@ public class SelectorImpl extends AbstractSelector ...@@ -143,18 +143,18 @@ public class SelectorImpl extends AbstractSelector
return 0; return 0;
} }
int ret = 0;
deregisterCancelledKeys(); deregisterCancelledKeys();
// Set only keys with the needed interest ops into the arrays. // Set only keys with the needed interest ops into the arrays.
int[] read = getFDsAsArray (SelectionKey.OP_READ | SelectionKey.OP_ACCEPT); int[] read = getFDsAsArray (SelectionKey.OP_READ | SelectionKey.OP_ACCEPT);
int[] write = getFDsAsArray (SelectionKey.OP_WRITE | SelectionKey.OP_CONNECT); int[] write = getFDsAsArray (SelectionKey.OP_WRITE | SelectionKey.OP_CONNECT);
int[] except = new int [0]; // FIXME: We dont need to check this yet int[] except = new int [0]; // FIXME: We dont need to check this yet
// Call the native select () on all file descriptors.
int anzahl = read.length + write.length + except.length; int anzahl = read.length + write.length + except.length;
ret = java_do_select (read, write, except, timeout);
// Call the native select() on all file descriptors.
begin();
int result = implSelect (read, write, except, timeout);
end();
Iterator it = keys.iterator (); Iterator it = keys.iterator ();
...@@ -216,7 +216,7 @@ public class SelectorImpl extends AbstractSelector ...@@ -216,7 +216,7 @@ public class SelectorImpl extends AbstractSelector
} }
deregisterCancelledKeys(); deregisterCancelledKeys();
return ret; return result;
} }
public final Set selectedKeys() public final Set selectedKeys()
......
...@@ -42,7 +42,7 @@ helper_get_filedescriptors (jintArray& fdArray, fd_set fds) ...@@ -42,7 +42,7 @@ helper_get_filedescriptors (jintArray& fdArray, fd_set fds)
} }
jint jint
gnu::java::nio::SelectorImpl::java_do_select (jintArray read, jintArray write, gnu::java::nio::SelectorImpl::implSelect (jintArray read, jintArray write,
jintArray except, jlong timeout) jintArray except, jlong timeout)
{ {
jint result; jint result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment