seda.nbio.SelectSetDevPollImpl Class Reference

Inherits seda.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

static 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

static 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

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


Constructor & Destructor Documentation

seda.nbio.SelectSetDevPollImpl.SelectSetDevPollImpl (  )  [package]

Create a SelectSetDevPollImpl with no SelectItems.


Member Function Documentation

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

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

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

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

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

void seda.nbio.SelectSetDevPollImpl.updateitemarr (  )  [private]

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

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

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

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

Add a SelectItem to this SelectSetDevPollImpl.

Implements seda.nbio.SelectSetImpl.

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

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

Implements seda.nbio.SelectSetImpl.

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

Remove a SelectItem from the SelectSetDevPollImpl.

Implements seda.nbio.SelectSetImpl.

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

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

Implements seda.nbio.SelectSetImpl.

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

Remove the SelectItem at the given index from the SelectSetDevPollImpl.

Implements seda.nbio.SelectSetImpl.

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

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

Implements seda.nbio.SelectSetImpl.

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

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

Implements seda.nbio.SelectSetImpl.

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

Return the number of SelectItems in this SelectSetDevPollImpl.

Implements seda.nbio.SelectSetImpl.

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

Return the number of active SelectItems in this SelectSetDevPollImpl.

Implements seda.nbio.SelectSetImpl.

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

Return the SelectItem at the given index.

Implements seda.nbio.SelectSetImpl.

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

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

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

String seda.nbio.SelectSetDevPollImpl.toString (  ) 


Member Data Documentation

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

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

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

long seda.nbio.SelectSetDevPollImpl.native_state [private]

Vector seda.nbio.SelectSetDevPollImpl.vec [private]

boolean seda.nbio.SelectSetDevPollImpl.needUpdate [private]

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

SelectItem seda.nbio.SelectSetDevPollImpl.retevents[] [private]

int seda.nbio.SelectSetDevPollImpl.retevents_length [private]

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


The documentation for this class was generated from the following file:
Generated on Fri Nov 10 00:45:48 2006 for libnbio2-java by  doxygen 1.5.1