|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnachos.kernel.threads.test.ThreadTest
public class ThreadTest
Set up a ping-pong between two threads, by forking two threads to execute SimpleRunnable objects.
Field Summary | |
---|---|
private static java.util.Collection |
argsC
Collection containing the command-line arguments. |
private static ThreadTest |
t1
Static variables to hold the instances we create and keep them from being garbage collected. |
private static ThreadTest |
t2
Static variables to hold the instances we create and keep them from being garbage collected. |
private int |
which
Integer identifier that indicates which thread we are. |
Constructor Summary | |
---|---|
ThreadTest(int w)
Initialize an instance of ThreadTest and start a new thread running on it. |
Method Summary | |
---|---|
void |
run()
Loop 5 times, yielding the CPU to another ready thread each iteration. |
static void |
start(java.lang.String[] args)
Entry point for the test. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static ThreadTest t1
private static ThreadTest t2
private int which
private static java.util.Collection argsC
Constructor Detail |
---|
public ThreadTest(int w)
w
- An integer identifying this instance of ThreadTest.Method Detail |
---|
public static void start(java.lang.String[] args)
args
- Array containing command-line arguments.public void run()
run
in interface java.lang.Runnable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |