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

seda.nbio.SelectSetPollImpl Class Reference

Inherits seda.nbio.SelectSetImpl.

List of all members.


Detailed Description

SelectSetPollImpl is an implementation of SelectSet which uses the UNIX poll(2) system call.

See also:
SelectSet


Public Member Functions

String toString ()

Package Functions

 SelectSetPollImpl ()
 Create a SelectSetPollImpl with no SelectItems.

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

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

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

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

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

void update ()
 Update any changed event masks in the SelectSet.

void update (SelectItem sel)
 Update any changed event masks in this SelectItem.

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

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

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 SelectSetPollImpl.

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 poll(2) is supported on this platform.


Private Member Functions

native int doSelect (int timeout)
void itemarrupdate ()

Private Attributes

Vector vec
SelectItem itemarr []
boolean needUpdate = false
int cachedActiveCount = -1


Constructor & Destructor Documentation

seda.nbio.SelectSetPollImpl.SelectSetPollImpl  )  [package]
 

Create a SelectSetPollImpl with no SelectItems.


Member Function Documentation

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

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

Implements seda.nbio.SelectSetImpl.

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

Add a SelectItem to this SelectSetPollImpl.

Implements seda.nbio.SelectSetImpl.

native int seda.nbio.SelectSetPollImpl.doSelect int  timeout  )  [private]
 

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

Return the SelectItem at the given index.

Implements seda.nbio.SelectSetImpl.

synchronized SelectItem [] seda.nbio.SelectSetPollImpl.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 seda.nbio.SelectSetImpl.

synchronized SelectItem [] seda.nbio.SelectSetPollImpl.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 seda.nbio.SelectSetImpl.

boolean seda.nbio.SelectSetPollImpl.isSupported  )  [static, package]
 

Returns true if poll(2) is supported on this platform.

void seda.nbio.SelectSetPollImpl.itemarrupdate  )  [private]
 

synchronized int seda.nbio.SelectSetPollImpl.numActive  )  [package, virtual]
 

Return the number of active SelectItems in this SelectSetPollImpl.

Implements seda.nbio.SelectSetImpl.

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

Remove the SelectItem at the given index from the SelectSetPollImpl.

Implements seda.nbio.SelectSetImpl.

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

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

Implements seda.nbio.SelectSetImpl.

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

Remove a SelectItem from the SelectSetPollImpl.

Implements seda.nbio.SelectSetImpl.

int seda.nbio.SelectSetPollImpl.select int  timeout  )  [package, virtual]
 

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

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 seda.nbio.SelectSetImpl.

synchronized int seda.nbio.SelectSetPollImpl.size  )  [package, virtual]
 

Return the number of SelectItems in this SelectSetPollImpl.

Implements seda.nbio.SelectSetImpl.

String seda.nbio.SelectSetPollImpl.toString  ) 
 

void seda.nbio.SelectSetPollImpl.update SelectItem  sel  )  [package, virtual]
 

Update any changed event masks in this SelectItem.

Does nothing in this implementation.

Implements seda.nbio.SelectSetImpl.

void seda.nbio.SelectSetPollImpl.update  )  [package, virtual]
 

Update any changed event masks in the SelectSet.

Does nothing in this implementation.

Implements seda.nbio.SelectSetImpl.


Member Data Documentation

int seda.nbio.SelectSetPollImpl.cachedActiveCount = -1 [private]
 

SelectItem seda.nbio.SelectSetPollImpl.itemarr[] [private]
 

boolean seda.nbio.SelectSetPollImpl.needUpdate = false [private]
 

Vector seda.nbio.SelectSetPollImpl.vec [private]
 


The documentation for this class was generated from the following file:
Generated on Fri Aug 13 10:57:53 2004 for libnbio2-java by doxygen 1.3.7