Thread

public class Thread extends Object
implements Runnable
Known Direct Subclasses

Simplified iOS version of java.lang.Thread, based on Apache Harmony source (both luni-kernel and vmcore). This class uses pthread for thread creation and maintains a pthread handle for using other pthread functionality. pthread's thread local mechanism (pthread_setspecific) is used to associate this wrapper object with the current thread.

Nested Class Summary

enum Thread.State A representation of a thread's state. 
interface Thread.UncaughtExceptionHandler  

Constant Summary

int MAX_PRIORITY

The maximum priority value allowed for a thread.

int MIN_PRIORITY

The minimum priority value allowed for a thread.

int NORM_PRIORITY

The normal (default) priority value assigned to threads.

Public Constructor Summary

Thread()
Constructs a new Thread with no runnable object and a newly generated name.
Thread(Runnable runnable)
Constructs a new Thread with a runnable object and a newly generated name.
Thread(Runnable runnable, String threadName)
Constructs a new Thread with a runnable object and name provided.
Thread(String threadName)
Constructs a new Thread with no runnable object and the name provided.
Thread(ThreadGroup group, Runnable runnable)
Constructs a new Thread with a runnable object and a newly generated name.
Thread(ThreadGroup group, Runnable runnable, String threadName, long stack)
Constructs a new Thread with a runnable object, the given name and belonging to the ThreadGroup passed as parameter.
Thread(ThreadGroup group, Runnable runnable, String threadName)
Constructs a new Thread with a runnable object, the given name and belonging to the ThreadGroup passed as parameter.
Thread(ThreadGroup group, String threadName)
Constructs a new Thread with no runnable object, the given name and belonging to the ThreadGroup passed as parameter.

Public Method Summary

static int
void
blockedOn(Interruptible b)
Set the IOBlocker field; invoked from java.nio code.
void
int
static Thread
void
static void
dumpStack()
Prints to the standard error stream a text representation of the current stack for this Thread.
static int
enumerate(Thread[] threads)
static Map<ThreadStackTraceElement[]>
getAllStackTraces()
Returns a map of stack traces for all live threads.
ClassLoader
getContextClassLoader()
Returns the context ClassLoader for this Thread.
static Thread.UncaughtExceptionHandler
getDefaultUncaughtExceptionHandler()
Returns the default exception handler that's executed when uncaught exception terminates a thread.
long
getId()
final String
final int
StackTraceElement[]
Thread.State
ThreadGroup
Thread.UncaughtExceptionHandler
getUncaughtExceptionHandler()
Returns the handler invoked when this thread abruptly terminates due to an uncaught exception.
static boolean
holdsLock(Object object)
Indicates whether the current Thread has a monitor lock on the specified object.
void
interrupt()
Posts an interrupt request to this Thread.
static boolean
interrupted()
Returns a boolean indicating whether the current Thread ( currentThread()) has a pending interrupt request ( true) or not (false).
final boolean
boolean
boolean
isInterrupted()
Returns a boolean indicating whether the receiver has a pending interrupt request (true) or not ( false)
final void
join()
Blocks the current Thread (Thread.currentThread()) until the receiver finishes its execution and dies.
final void
join(long millis)
Blocks the current Thread (Thread.currentThread()) until the receiver finishes its execution and dies or the specified timeout expires, whatever happens first.
final void
join(long millis, int nanos)
Blocks the current Thread (Thread.currentThread()) until the receiver finishes its execution and dies or the specified timeout expires, whatever happens first.
final void
resume()
void
run()
When an object implementing interface Runnable is used to create a thread, starting the thread causes the object's run method to be called in that separately executing thread.
void