wrapper java.lang.Thread requiredif RThread, RSystemThreads {
requires java.lang.RThreadMap;
requires java.lang.RThreadGroupMap;
state RThread rthread;
helper static void initThread (ThreadGroup g) {
if (naccio.library.NCheck.isInitialized ()) {
if (g == null) {
SecurityManager security;
security = System.getSecurityManager();
// If there is a security manager, ask the security manager
// what to do.
if (security != null) {
g = security.getThreadGroup();
}
// If the security doesn't have a strong opinion of the matter
// use the parent thread group.
if (g == null) {
Thread parent;
parent = currentThread ();
g = parent.getThreadGroup();
}
}
RThread tg;
tg = RThreadGroupMap.lookupAdd (g);
RSystemThreads.access (tg);
}
}
helper void setupThread () {
if (naccio.library.NCheck.isInitialized ()) {
Thread parent;
parent = currentThread ();
RSystemThreads.setThreadPriority (rthread, parent.getPriority ());
}
}
wrapper Thread () {
initThread (null);
#;
rthread = RThreadMap.add (this);
setupThread ();
}
wrapper Thread (java.lang.Runnable target) {
initThread (null);
#;
rthread = RThreadMap.add (this);
setupThread ();
}
wrapper Thread (ThreadGroup tgroup, Runnable target) {
initThread (tgroup);
#;
rthread = RThreadMap.add (this);
setupThread ();
}
wrapper Thread (String name) {
initThread (null);
#;
rthread = RThreadMap.add (this);
setupThread ();
}
wrapper Thread (ThreadGroup tgroup, String name) {
initThread (tgroup);
#;
rthread = RThreadMap.add (this);
setupThread ();
}
wrapper Thread (Runnable target, String name) {
initThread (null);
#;
rthread = RThreadMap.add (this);
setupThread ();
}
wrapper Thread (ThreadGroup tgroup, Runnable target, String name) {
initThread (tgroup);
#;
rthread = RThreadMap.add (this);
setupThread ();
}
wrapper void setDaemon (boolean on) {
if (on) {
RSystemThreads.setDaemonThread (rthread);
} else {
RSystemThreads.setUserThread (rthread);
}
#;
}
wrapper void stop (Throwable o) {
// Stop resumes a thread before stopping it!
RSystemThreads.resumeThread (rthread);
RSystemThreads.stopThread (rthread);
#;
}
wrapper void stop () {
RSystemThreads.resumeThread (rthread);
RSystemThreads.stopThread (rthread);
#;
}
wrapper void interrupt () {
RSystemThreads.interruptThread (rthread);
#;
}
wrapper void destroy () {
RSystemThreads.destroyThread (rthread);
#;
}
wrapper void suspend () {
RSystemThreads.suspendThread (rthread);
#;
}
wrapper void resume () {
RSystemThreads.resumeThread (rthread);
#;
}
wrapper void setPriority (int newPriority) {
RSystemThreads.setThreadPriority (rthread, newPriority);
#;
}
wrapper void setName (String name) {
RSystemThreads.setThreadName (rthread, name);
#;
}
}
Naccio Home Page
University of Virginia, Computer Science