Alias for the select() method as we're not reimplementing it in this class.
Close the selector.
Return the number of keys resulting from the registration of a conduit to the selector.
Return the selection key resulting from the registration of a conduit to the selector.
Iterate through the currently registered selection keys. Note that you should not erase or add any items from the selector while iterating, although you can register existing conduits again.
Open the select()-based selector.
Associate a conduit to the selector and track specific I/O events. If a conduit is already associated with the selector, the events and attachment are upated.
Wait for I/O events from the registered conduits for a specified amount of time.
Return the selection set resulting from the call to any of the select() methods.
Remove a conduit from the selector.
Default number of SelectionKey's that will be handled by the SelectSelector.
Default number of SelectionKey's that will be handled by the SelectSelector.
Restart interrupted system calls when blocking inside a call to select.
Indicates whether interrupted system calls will be restarted when blocking inside a call to select.
Sets whether interrupted system calls will be restarted when blocking inside a call to select.
Initialize the selector.
Free any operating system resources that may have been allocated in the call to open().
Associate a conduit to the selector and track specific I/O events.
Deprecated, use register instead
Remove a conduit from the selector.
Wait for I/O events from the registered conduits for a specified amount of time.
Wait for I/O events from the registered conduits for a specified amount of time.
Wait for I/O events from the registered conduits for a specified amount of time.
Return the selection set resulting from the call to any of the select() methods.
Return the selection key resulting from the registration of a conduit to the selector.
Return the number of keys resulting from the registration of a conduit to the selector.
* Cast the time duration to a C timeval struct.
Check the 'errno' global variable from the C standard library and throw an exception with the description of the error.
import tango.io.selector.SelectSelector; Socket socket; ISelector selector = new SelectSelector(); selector.open(100, 10); // Register to read from socket selector.register(socket, Event.Read); int eventCount = selector.select(0.1); // 0.1 seconds if (eventCount > 0) { // We can now read from the socket socket.read(); } else if (eventCount == 0) { // Timeout } else if (eventCount == -1) { // Another thread called the wakeup() method. } else { // Error: should never happen. } selector.close();
Selector that uses the select() system call to receive I/O events for the registered conduits. To use this class you would normally do something like this: