All Packages  This Package  Class Hierarchy  Class Search  Index

Class utah.npm.core.Thread
java.lang.Object
   |
   +----Refable
           |
           +----utah.npm.core.Thread

  Summary

public class  Thread
     extends Refable
{
          // Constructors 2
     public Thread(Reference, Reference, Reference, Reference);
     public Thread(Reference, Reference, Reference, Reference, int);

          // Methods 9
     public static void interrupt(Thread);
     public static boolean interrupted();
     public static final native Thread self();

     public void destroy();
     public boolean getClient(Reference);
     public boolean getServer(Reference);
     public void setClient(Reference, boolean);
     public void setServer(Reference, boolean);
     public String toString();
}

Threads are implement the Nested Process Model as a layer beneath java.lang.Thread. Threads keep track of IPC state, per-thread space state, and per-thread scheduling state.

I would like this class to be final, so that clients cannot override any of the methods and pass them off to other code. But then I can't make java.lang.Thread a subclass of it. So, I just need to be careful about which methods are final and which are not. Also, all "protected" scope variables and methods will be visible in subclasses and must be either final or harmless.

Thread state for specific thread areas is kept in separate object. For example, all Thread-related IPC state and methods (actually all the IPC state and methods) are in ThreadIPC. Per-thread wait state and methods are in ThreadWait. ThreadSpace is the per-thread space state, and ThreadSched is the per-thread scheduling state.

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

See Also: Thread, ThreadIPC, ThreadWait, ThreadSpace, ThreadSched




  Constructors

· Thread

Summary  |  Top

   public Thread(Reference spaceRef, 
                 Reference schedPortRef, 
                 Reference clientRef, 
                 Reference serverRef) 

Create a new NPM Thread. The thread will be associated with the given space, scheduling requests will be sent to the given scheduing port, and the client and server links will be set to the provided thread references.

TODO: None of the values of these References is actually useful.

Parameter Description
spaceRef a reference to the space this thread is associated with.
schedPortRef a reference to a port to send scheduling decisions to.
clientRef a reference to a thread to install as the client thread of the new thread.
serverRef a reference to a thread to install as the server thread of the new thread.



· Thread

Summary  |  Top
   public Thread(Reference spaceRef, 
                 Reference schedPortRef, 
                 Reference clientRef, 
                 Reference serverRef, 
                 int hashCode) 

Same as the previous contructor but with hashCode value to associate with the thread.



  Methods

· self

Summary  |  Top
   public static final native Thread self() 

A static method which returns the currently running Thread's thread object.

Returns:
the Thread object corresponding to the currently running thread.


· interrupt

Summary  |  Top
   public static void interrupt(Thread thread) 

Post an interrupt in the target thread.

TODO: not implemented. deprecated(?)

Parameter Description
thread the thread to interrupt.



· interrupted

Summary  |  Top
   public static boolean interrupted() 

Determine if the current thread has an outstanding interrupt posted.

TODO: not implemented. deprecated(?)

Returns:
true if the current thread has an interrupt outstanding, false if not.


· getClient

Summary  |  Top
   public boolean getClient(Reference out_clientThreadRef) 

Get this thread's reliable IPC client connection state.

Parameter Description
out_clientThreadRef An NPM Reference that will be set to the state of the client thread.

Returns:
The client connection direction flag (true means sender, false means receiver.)


· setClient

Summary  |  Top
   public void setClient(Reference clientThreadRef, 
                         boolean isSender) 

Set this thread's reliable IPC client connection state.

Parameter Description
clientThreadRef An NPM Reference that will be set to the state of the client thread.
isSender indicates if client is currently the sender



· getServer

Summary  |  Top
   public boolean getServer(Reference out_serverThreadRef) 

Get this thread's reliable IPC server connection state.

Parameter Description
out_serverThreadRef An NPM Reference that will be set to the state of the server thread.

Returns:
The server connection direction (true if server is sender, false if receiver.)


· setServer

Summary  |  Top
   public void setServer(Reference serverThreadRef, 
                         boolean isSender) 

Set this thread's reliable IPC server connection state.

Parameter Description
serverThreadRef An NPM Reference that will be set to the state of the server thread.
isSender indicates if server is currently the sender.



· destroy

Summary  |  Top
   public void destroy() 

Destroy this thread. Clears all links this thread owns and stops it.

TODO: Must the thread be dead to call this? Can it stop a running thread?



· toString

Summary  |  Top
   public String toString() 

Generates a simple string representation of this thread.

Returns:
the string "Thread (id" +hashCode+ ")"


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