Thread Class

Definition

A thread is a thread of execution in a program.

[Android.Runtime.Register("java/lang/Thread", DoNotGenerateAcw=true)]
public class Thread : Java.Lang.Object, IDisposable, Java.Interop.IJavaPeerable, Java.Lang.IRunnable
[<Android.Runtime.Register("java/lang/Thread", DoNotGenerateAcw=true)>]
type Thread = class
    inherit Object
    interface IRunnable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
Thread
Derived
Attributes
Implements

Remarks

Java documentation for java.lang.Thread.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

Thread()

Allocates a new Thread object.

Thread(Action)
Thread(Action, String)
Thread(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Thread(IRunnable)

Allocates a new Thread object.

Thread(IRunnable, String)

Allocates a new Thread object.

Thread(String)

Allocates a new Thread object.

Thread(ThreadGroup, Action)
Thread(ThreadGroup, Action, String)
Thread(ThreadGroup, Action, String, Int64)
Thread(ThreadGroup, IRunnable)

Allocates a new Thread object.

Thread(ThreadGroup, IRunnable, String)

Allocates a new Thread object.

Thread(ThreadGroup, IRunnable, String, Int64)

Allocates a new Thread object.

Thread(ThreadGroup, String)

Allocates a new Thread object.

Fields

MaxPriority

The maximum priority that a thread can have.

MinPriority

The minimum priority that a thread can have.

NormPriority

The default priority that is assigned to a thread.

Properties

AllStackTraces

Returns a map of stack traces for all live threads.

Class

Returns the runtime class of this Object.

(Inherited from Object)
ContextClassLoader

Returns the context ClassLoader for this Thread. -or- Sets the context ClassLoader for this Thread.

Daemon

Tests if this thread is a daemon thread. -or- Marks this thread as either a #isDaemon daemon thread or a user thread.

DefaultUncaughtExceptionHandler

Returns the default handler invoked when a thread abruptly terminates due to an uncaught exception. -or- Set the default handler invoked when a thread abruptly terminates due to an uncaught exception, and no other handler has been defined for that thread.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
Id

Returns the identifier of this Thread.

IsAlive

Tests if this thread is alive.

IsInterrupted

Tests whether this thread has been interrupted.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
Name

Returns this thread's name. -or- Changes the name of this thread to be equal to the argument <code>name</code>.

PeerReference (Inherited from Object)
Priority

Returns this thread's priority. -or- Changes the priority of this thread.

ThreadGroup

Returns the thread group to which this thread belongs.

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

UncaughtExceptionHandler

Returns the handler invoked when this thread abruptly terminates due to an uncaught exception. -or- Set the handler invoked when this thread abruptly terminates due to an uncaught exception.

Methods

ActiveCount()

Returns an estimate of the number of active threads in the current thread's java.

CheckAccess()

Determines if the currently running thread has permission to modify this thread.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
CountStackFrames()
Obsolete.

Counts the number of stack frames in this thread.

CurrentThread()

Returns a reference to the currently executing thread object.

Destroy()
Obsolete.

Throws UnsupportedOperationException.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
DumpStack()

Prints a stack trace of the current thread to the standard error stream.

Enumerate(Thread[])

Copies into the specified array every active thread in the current thread's thread group and its subgroups.

Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetStackTrace()

Returns an array of stack trace elements representing the stack dump of this thread.

GetState()

Returns the state of this thread.

HoldsLock(Object)

Returns true if and only if the current thread holds the monitor lock on the specified object.

Interrupt()

Interrupts this thread.

Interrupted()

Tests whether the current thread has been interrupted.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Join()

Waits for this thread to die.

Join(Int64)

Waits for this thread to die.

Join(Int64, Int32)

Waits for this thread to die.

Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
Resume()
Obsolete.

Throws UnsupportedOperationException.

Run()

If this thread was constructed using a separate <code>Runnable</code> run object, then that <code>Runnable</code> object's <code>run</code> method is called; otherwise, this method does nothing and returns.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
Sleep(Int64)

Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds, subject to the precision and accuracy of system timers and schedulers.

Sleep(Int64, Int32)

Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds, subject to the precision and accuracy of system timers and schedulers.

Start()

Causes this thread to begin execution; the Java Virtual Machine calls the <code>run</code> method of this thread.

Stop()
Obsolete.

Throws UnsupportedOperationException.

Stop(Throwable)
Obsolete.

Throws UnsupportedOperationException.

Suspend()
Obsolete.

Throws UnsupportedOperationException.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object.

(Inherited from Object)
Yield()

A hint to the scheduler that the current thread is willing to yield its current use of a processor.

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to