Name
Thread
Synopsis
This class encapsulates all information
about a single thread of control running on the Java interpreter. To
create a thread, you must either pass a Runnable
object (i.e., an object that implements the
Runnable interface by defining a run(
) method) to the Thread constructor or
subclass Thread so that it defines its own
run( ) method. The run( )
method of the Thread or of the specified
Runnable object is the body of the thread. It
begins executing when the start( ) method of the
Thread object is called. The thread runs until the
run( ) method returns. isAlive(
) returns true if a thread has been
started, and the run( ) method has not yet exited.
The static methods of this class
operate on the currently running thread. currentThread(
) returns the Thread object of the
currently running code. sleep( ) makes the current
thread stop for a specified amount of time. yield(
) makes the current thread give up control to any other
threads of equal priority that are waiting to run.
holdsLock( ) tests whether the current thread
holds a lock (through a synchronized method or
statement) on the specified object; this Java 1.4 method is often
useful with an assert statement.
The instance methods may be called by
one thread to operate on a different thread. checkAccess(
) checks whether the running thread has permission to
modify a Thread object and throws a
SecurityException if it does not. join(
) waits for a thread to die. interrupt(
) wakes up a waiting or sleeping ...