All Packages  This Package  Class Hierarchy  Class Search  Index

Class utah.npm.core.ThreadWait
java.lang.Object
   |
   +----utah.npm.core.Lockable
           |
           +----utah.npm.core.ThreadWait

  Summary

final class  ThreadWait
     extends utah.npm.core.Lockable
{
          // Fields 18
     static final int IPC_CL_ACK;
     static final int IPC_CL_ANY;
     static final int IPC_CL_CONNECT;
     static final int IPC_CL_DISCONN;
     static final int IPC_CL_OVER;
     static final int IPC_CL_RECV;
     static final int IPC_CL_SEND;
     static final int IPC_SR_ACK;
     static final int IPC_SR_ANY;
     static final int IPC_SR_CONNECT;
     static final int IPC_SR_DISCONN;
     static final int IPC_SR_OVER;
     static final int IPC_SR_RECV;
     static final int IPC_SR_SEND;
     static final int WAIT_NONE;
     private int resumeRC_;
     private boolean validWakeup_;
     private int waitState_;

          // Constructors 1
     public ThreadWait();

          // Methods 7
     boolean captureIn(int);
     String debugInfo();
     void destroy();
     boolean isWaitingIn(int);
     void kick(int);
     void setWaitState(int);
     int waitIn(int, Lockable, int);
}

Per-thread "wait" information. This class encapsulates thread sleeping, and lets other threads "capture" sleeping threads.

Version:
NPMJava 0.5.0 April, 1998
Author:
Patrick Tullmann tullmann@cs.utah.edu




  Fields

· waitState_

Summary  |  Top

   private int waitState_

The state this thread is "waiting in". This identifies what sort of event this thread is blocked on. The envents are defined below.


· resumeRC_

Summary  |  Top
   private int resumeRC_

The standard integer status code this thread is to return when it is awoken.


· validWakeup_

Summary  |  Top
   private boolean validWakeup_

A private boolean indicating if a thread wakeup was spurious or not.


· WAIT_NONE

Summary  |  Top
   static final int WAIT_NONE


· IPC_SR_DISCONN

Summary  |  Top
   static final int IPC_SR_DISCONN


· IPC_SR_CONNECT

Summary  |  Top
   static final int IPC_SR_CONNECT


· IPC_SR_SEND

Summary  |  Top
   static final int IPC_SR_SEND


· IPC_SR_RECV

Summary  |  Top
   static final int IPC_SR_RECV


· IPC_SR_ACK

Summary  |  Top
   static final int IPC_SR_ACK


· IPC_SR_OVER

Summary  |  Top
   static final int IPC_SR_OVER


· IPC_SR_ANY

Summary  |  Top
   static final int IPC_SR_ANY


· IPC_CL_DISCONN

Summary  |  Top
   static final int IPC_CL_DISCONN


· IPC_CL_CONNECT

Summary  |  Top
   static final int IPC_CL_CONNECT


· IPC_CL_SEND

Summary  |  Top
   static final int IPC_CL_SEND


· IPC_CL_RECV

Summary  |  Top
   static final int IPC_CL_RECV


· IPC_CL_ACK

Summary  |  Top
   static final int IPC_CL_ACK


· IPC_CL_OVER

Summary  |  Top
   static final int IPC_CL_OVER


· IPC_CL_ANY

Summary  |  Top
   static final int IPC_CL_ANY


  Constructors

· ThreadWait

Summary  |  Top

   public ThreadWait() 

Default constructor



  Methods

· captureIn

Summary  |  Top
   boolean captureIn(int expectedState) 

Capture this thread if its waiting in expectedState.

XXX This will have to go native when inheritance scheduling is implemented.

Parameter Description
expectedState must be on of the states defined above.

Returns:
true if the thread is captured, false otherwise.


· isWaitingIn

Summary  |  Top
   boolean isWaitingIn(int reqState) 

Check to seee if this thread is blocked in the given wait state (or some specialization of that wait state.)

Parameter Description
reqState the state to compare waitState_ against.

Returns:
true if thread is that state, false otherwise.


· waitIn

Summary  |  Top
   int waitIn(int waitState, 
              Lockable lock, 
              int resumeRC) 

Cause the current thread to wait in state waitState. When the thread resumes it will return its resumeRc, which will defaults to the provided resumeRC. (But, other threads can access and manipulate the resumeRC.) The provided Lockable object, if not null, will be unlocked before the thread is put to sleep.

This object had best be locked on entry, and is unlocked when the function returns.

This function will not return unless the calling thread is explicitly woken up by some other thread.

Parameter Description
waitState The wait state to record this thread as blocked in.
lock a lockable object to s_unlock() before sleeping.
resumeRC The initial value to use as a return code when the thread is awoken.

Returns:
The thread's resumeRc at the time of waking.

See Also: Lockable



· setWaitState

Summary  |  Top
   void setWaitState(int waitState) 

Set the current thread's recorded wait state. This should only be called on captured threads that already have some wait state.

Parameter Description
waitState the wait state to record.



· kick

Summary  |  Top
   void kick(int resumeRC) 

Resume this thread (which must be captured.)

Parameter Description
resumeRC return code for the target thread to resume with



· destroy

Summary  |  Top
   void destroy() 

Destroy this per-thread wait information. This is only called by Thread.destroy()

See Also: Thread.destroy



· debugInfo

Summary  |  Top
   String debugInfo() 

Return a string describing this thread's current wait state. TODO: remove dependencies on Integer class and StringBuffer class.

Returns:
a string describing this thread's current wait state.


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7