Main Page | Packages | Class Hierarchy | Compound List | File List | Compound Members

nbio.SelectSetDevPollImpl Class Reference

Inherits nbio.SelectSetImpl.

List of all members.


Detailed Description

SelectSetDevPollImpl is an implementation of SelectSet which uses the UNIX /dev/poll mechanism.

See also:
SelectSet


Public Member Functions

String toString ()

Package Functions

 SelectSetDevPollImpl ()
 Create a SelectSetDevPollImpl with no SelectItems.

synchronized void add (SelectItem sel)
 Add a SelectItem to this SelectSetDevPollImpl.

synchronized void add (SelectItem selarr[])
 Add all of the SelectItems in the given array to the SelectSetDevPollImpl.

synchronized void remove (SelectItem sel)
 Remove a SelectItem from the SelectSetDevPollImpl.

synchronized void remove (SelectItem selarr[])
 Remove all of the SelectItems in the given array from the SelectSetDevPollImpl.

synchronized void remove (int index)
 Remove the SelectItem at the given index from the SelectSetDevPollImpl.

synchronized void update ()
 Push updated event masks for all SelectItems in this SelectSet to the /dev/poll device.

synchronized void update (SelectItem sel)
 Push updated event masks for all SelectItems in this SelectSet to native code.

synchronized int size ()
 Return the number of SelectItems in this SelectSetDevPollImpl.

synchronized int numActive ()
 Return the number of active SelectItems in this SelectSetDevPollImpl.

synchronized SelectItem elementAt (int index)
 Return the SelectItem at the given index.

int select (int timeout)
 Wait for events to occur on the SelectItems in this SelectSetDevPollImpl.

synchronized SelectItem[] getEvents (short mask)
 Returns an array of SelectItems for which events matching the given event mask have occurred (that is, that the revents field matches the given mask).

synchronized SelectItem[] getEvents ()
 Returns an array of SelectItems for which some events have occurred (that is, that the revents field is nonzero).


Static Package Functions

boolean isSupported ()
 Returns true if /dev/poll is supported on this platform.


Private Member Functions

native void init (int max_retevents)
native void register (SelectItem sel)
native void deregister (SelectItem sel)
native int doSelect (int timeout, int num_fds_to_poll)
void updateitemarr ()
boolean checkFD (NBIOFileDescriptor fd)

Static Private Member Functions

native boolean supported ()

Private Attributes

long native_state
Vector vec
boolean needUpdate
SelectItem itemarr []
SelectItem retevents []
int retevents_length
int cachedActiveCount = -1

Static Private Attributes

final int MAX_EVENTS_PER_SELECT = 32768
 The maximum number of events to return on each call to doSelect().

final int TO_ALLOCATE = 256


Constructor & Destructor Documentation

nbio.SelectSetDevPollImpl.SelectSetDevPollImpl  )  [package]
 

Create a SelectSetDevPollImpl with no SelectItems.


Member Function Documentation

synchronized void nbio.SelectSetDevPollImpl.add SelectItem  selarr[]  )  [package, virtual]
 

Add all of the SelectItems in the given array to the SelectSetDevPollImpl.

Implements nbio.SelectSetImpl.

synchronized void nbio.SelectSetDevPollImpl.add SelectItem  sel  )  [package, virtual]
 

Add a SelectItem to this SelectSetDevPollImpl.

Implements nbio.SelectSetImpl.

boolean nbio.SelectSetDevPollImpl.checkFD NBIOFileDescriptor  fd  )  [private]
 

native void nbio.SelectSetDevPollImpl.deregister SelectItem  sel  )  [private]
 

native int nbio.SelectSetDevPollImpl.doSelect int  timeout,
int  num_fds_to_poll
[private]
 

synchronized SelectItem nbio.SelectSetDevPollImpl.elementAt int  index  )  [package, virtual]
 

Return the SelectItem at the given index.

Implements nbio.SelectSetImpl.

synchronized SelectItem [] nbio.SelectSetDevPollImpl.getEvents  )  [package, virtual]
 

Returns an array of SelectItems for which some events have occurred (that is, that the revents field is nonzero).

This is a convenience method and is not meant to be optimized; since it scans the SelectItem array and creates a new reference array, it imposes higher overhead than the application scanning the SelectItem array directly, using the size() and elementAt() methods.

Implements nbio.SelectSetImpl.

synchronized SelectItem [] nbio.SelectSetDevPollImpl.getEvents short  mask  )  [package, virtual]
 

Returns an array of SelectItems for which events matching the given event mask have occurred (that is, that the revents field matches the given mask).

This is a convenience method and is not meant to be optimized; since it scans the SelectItem array and creates a new reference array, it imposes higher overhead than the application scanning the SelectItem array directly, using the size() and elementAt() methods.

Implements nbio.SelectSetImpl.

native void nbio.SelectSetDevPollImpl.init int  max_retevents  )  [private]
 

boolean nbio.SelectSetDevPollImpl.isSupported  )  [static, package]
 

Returns true if /dev/poll is supported on this platform.

synchronized int nbio.SelectSetDevPollImpl.numActive  )  [package, virtual]
 

Return the number of active SelectItems in this SelectSetDevPollImpl.

Implements nbio.SelectSetImpl.

native void nbio.SelectSetDevPollImpl.register SelectItem  sel  )  [private]
 

synchronized void nbio.SelectSetDevPollImpl.remove int  index  )  [package, virtual]
 

Remove the SelectItem at the given index from the SelectSetDevPollImpl.

Implements nbio.SelectSetImpl.

synchronized void nbio.SelectSetDevPollImpl.remove SelectItem  selarr[]  )  [package, virtual]
 

Remove all of the SelectItems in the given array from the SelectSetDevPollImpl.

Implements nbio.SelectSetImpl.

synchronized void nbio.SelectSetDevPollImpl.remove SelectItem  sel  )  [package, virtual]
 

Remove a SelectItem from the SelectSetDevPollImpl.

Implements nbio.SelectSetImpl.

int nbio.SelectSetDevPollImpl.select int  timeout  )  [package, virtual]
 

Wait for events to occur on the SelectItems in this SelectSetDevPollImpl.

Upon return, the 'revents' field of each SelectItem will be set to the mask of events that occurred. Note that this method does not set revents to 0 when called; after processing an event, it is the application's responsibility to clear the revents field. This is intentional: if the application wishes to delay the processing of an event, it can leave the revents field as-is so that subsequent calls to select will continue to indicate that the event is pending.

IMPORTANT NOTE: If timeout is non-zero, this call will block the thread which invokes it. If you are using Green Threads, this will block the entire JVM. Unless you have a single-threaded application, you should only use SelectSet.select() with native threads.

Parameters:
timeout The maximum number of milliseconds to block waiting for an event to occur. A timeout of 0 means than select should not block; a timeout of -1 means that select should block indefinitely.
Returns:
The number of events received, or 0 if no events occurred.

Implements nbio.SelectSetImpl.

synchronized int nbio.SelectSetDevPollImpl.size  )  [package, virtual]
 

Return the number of SelectItems in this SelectSetDevPollImpl.

Implements nbio.SelectSetImpl.

native boolean nbio.SelectSetDevPollImpl.supported  )  [static, private]
 

String nbio.SelectSetDevPollImpl.toString  ) 
 

synchronized void nbio.SelectSetDevPollImpl.update SelectItem  sel  )  [package, virtual]
 

Push updated event masks for all SelectItems in this SelectSet to native code.

Implements nbio.SelectSetImpl.

synchronized void nbio.SelectSetDevPollImpl.update  )  [package, virtual]
 

Push updated event masks for all SelectItems in this SelectSet to the /dev/poll device.

Implements nbio.SelectSetImpl.

void nbio.SelectSetDevPollImpl.updateitemarr  )  [private]
 


Member Data Documentation

int nbio.SelectSetDevPollImpl.cachedActiveCount = -1 [private]
 

SelectItem nbio.SelectSetDevPollImpl.itemarr[] [private]
 

final int nbio.SelectSetDevPollImpl.MAX_EVENTS_PER_SELECT = 32768 [static, private]
 

The maximum number of events to return on each call to doSelect().

long nbio.SelectSetDevPollImpl.native_state [private]
 

boolean nbio.SelectSetDevPollImpl.needUpdate [private]
 

SelectItem nbio.SelectSetDevPollImpl.retevents[] [private]
 

int nbio.SelectSetDevPollImpl.retevents_length [private]
 

final int nbio.SelectSetDevPollImpl.TO_ALLOCATE = 256 [static, private]
 

Vector nbio.SelectSetDevPollImpl.vec [private]
 


The documentation for this class was generated from the following file:
Generated on Fri Jul 18 21:37:52 2003 for libnbio2-java by doxygen 1.3.2