All Packages This Package Class Hierarchy Class Search Index
java.lang.Object | +----utah.npm.core.Lockable | +----utah.npm.core.NPMObject | +----utah.npm.core.Refable | +----utah.npm.core.Thread
Summary |
public class Thread extends utah.npm.core.Refable { // Fields 11 static final int DEFAULT_gFlags; static final int FLAG_INCLASSFAULT; static final int FLAG_INTERRUPT_PENDING; static final int FLAG_STOPPED; int gFlags_; private static Thread head_; private Thread next_; final ThreadIPC s_ipcState_; final ThreadSched s_schedState_; final ThreadSpace s_spaceState_; final ThreadWait s_waitState_; // Constructors 2 public Thread(Reference, Reference, Reference, Reference); public Thread(Reference, Reference, Reference, Reference, int); // Methods 16 static void dumpThreads(); public static void interrupt(Thread); public static boolean interrupted(); public static final native Thread self(); static String typeName(); public String debugInfo(); public void destroy(); public boolean getClient(Reference); public boolean getServer(Reference); private void s_init(Reference, Reference, Reference, Reference, int); private int s_threadVMSpace(); int s_type(); public void setClient(Reference, boolean); public void setServer(Reference, boolean); public String toString(); private native void vm_destroy(); }
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.
See Also: Thread, ThreadIPC, ThreadWait, ThreadSpace, ThreadSched
Fields |
· DEFAULT_gFlags | Summary | Top |
static final int DEFAULT_gFlags
· s_ipcState_ | Summary | Top |
final ThreadIPC s_ipcState_
Per-thread IPC specific state. This object actually implements the majority of the IPC semantics. Only assigned at object creation time.
· s_waitState_ | Summary | Top |
final ThreadWait s_waitState_
Per-thread info on blocked states and where the thread is waiting.
· s_spaceState_ | Summary | Top |
final ThreadSpace s_spaceState_
Per-thread Space state.
· s_schedState_ | Summary | Top |
final ThreadSched s_schedState_
Per-thread scheduling state. Overlaps a bit with ThreadWait state. Have to wait and see...
· gFlags_ | Summary | Top |
int gFlags_
Thread status flags.
XXX: Redundant with the flags in the VM-private thread state.
· FLAG_INTERRUPT_PENDING | Summary | Top |
static final int FLAG_INTERRUPT_PENDING
· FLAG_STOPPED | Summary | Top |
static final int FLAG_STOPPED
· FLAG_INCLASSFAULT | Summary | Top |
static final int FLAG_INCLASSFAULT
· head_ | Summary | Top |
private static Thread head_
· next_ | Summary | Top |
private Thread next_
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 |
· s_init | Summary | Top |
private void s_init(Reference spaceRef, Reference schedPortRef, Reference clientRef, Reference serverRef, int hashCode)
Private thread initialization.
· 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.
· vm_destroy | Summary | Top |
private native void vm_destroy()
Destroy VM-private thread state.
· 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?
- Overrides:
- destroy in class Refable
· s_threadVMSpace | Summary | Top |
private int s_threadVMSpace()
Return the VM-specific Space state associated with this thread. This method is private, and is only called directly by the VM itself.
This method does not require that the thread object be locked.
- Returns:
- the VM-specifc Space state (an integer).
· toString | Summary | Top |
public String toString()
Generates a simple string representation of this thread.
- Returns:
- the string "Thread (id" +
hashCode
+ ")"- Overrides:
- toString in class NPMObject
· typeName | Summary | Top |
static String typeName()
Return the string "Thread".
- Returns:
- the string "Thread"
- Overrides:
- typeName in class NPMObject
· s_type | Summary | Top |
int s_type()
Return the integer identifier for Thread type, NPMObject.ThreadType
- Returns:
- NPMObject.ThreadType
- Overrides:
- s_type in class NPMObject
See Also: NPMObject.ThreadType
· debugInfo | Summary | Top |
public String debugInfo()
· dumpThreads | Summary | Top |
static void dumpThreads()
All Packages This Package Class Hierarchy Class Search IndexFreshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7