Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## java.lang
Class Thread

    java.lang.Object
      java.lang.Thread

Direct Known Subclasses:
  ActivityBase

    public abstract class Thread

extends Object

A thread of execution (or task). Now handles priorities, daemon threads and interruptions.

Field Summary
`static int` | `MAX_PRIORITY` The maximum priority that a thread can have.
`static int` | `MIN_PRIORITY` The minimum priority that a thread can have.
`static int` | `NORM_PRIORITY` The priority that is assigned to the primordial thread.

Constructor Summary
`Thread()`
`Thread(String name)`

Method Summary
`static Thread` | `currentThread()`
`int` | `getPriority()`
`void` | `interrupt()` Set the interrupted flag.
`static boolean` | `interrupted()`
`boolean` | `isAlive()`
`boolean` | `isDaemon()` Set the daemon flag.
`boolean` | `isInterrupted()`
`void` | `join()` Join not yet implemented
`void` | `join(long timeout)`
`abstract void` | `run()`
`void` | `setDaemon(boolean on)`
`void` | `setPriority(int priority)` Set the priority of this thread.
`static void` | `sleep(long aMilliseconds)`
`void` | `start()`
`static void` | `yield()`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait`

Field Detail

### MIN_PRIORITY

    public static final int MIN_PRIORITY

  The minimum priority that a thread can have. The value is 1.

  See Also:
    Constant Field Values

### NORM_PRIORITY

    public static final int NORM_PRIORITY

  The priority that is assigned to the primordial thread. The value is 5.

  See Also:
    Constant Field Values

### MAX_PRIORITY

    public static final int MAX_PRIORITY

  The maximum priority that a thread can have. The value is 10.

  See Also:
    Constant Field Values

Constructor Detail

### Thread

    public Thread()

### Thread

    public Thread(String name)

Method Detail

### isAlive

    public final boolean isAlive()

### run

    public abstract void run()

### start

    public final void start()

### yield

    public static void yield()

### sleep

    public static void sleep(long aMilliseconds)
                      throws InterruptedException

  Throws:
    `InterruptedException`

### currentThread

    public static Thread currentThread()

### getPriority

    public final int getPriority()

### setPriority

    public final void setPriority(int priority)

  Set the priority of this thread. Higher number have higher priority. The scheduler will always run the highest priority thread in preference to any others. If more than one thread of that priority exists the scheduler will time-slice them. In order for lower priority threas to run a higher priority thread must cease to be runnable. i.e. it must exit, sleep or wait on a monitor. It is not sufficient to just yield.

  Threads inherit the priority of their parent. The primordial thread has priority NORM_PRIORITY.

  Parameters:
    `priority` - must be between MIN_PRIORITY and MAX_PRIORITY.

### interrupt

    public void interrupt()

  Set the interrupted flag. If we are asleep we will wake up and an InterruptedException will be thrown.

### interrupted

    public static boolean interrupted()

### isInterrupted

    public final boolean isInterrupted()

### isDaemon

    public final boolean isDaemon()

  Set the daemon flag. If a thread is a daemon thread its existence will not prevent a JVM from exiting.

### setDaemon

    public final void setDaemon(boolean on)

### join

    public final void join()
                    throws InterruptedException

  Join not yet implemented

  Throws:
    `InterruptedException`

### join

    public final void join(long timeout)
                    throws InterruptedException

  Throws:
    `InterruptedException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD