Share via


Thread.Enumerate(Thread[]) Method

Definition

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

[Android.Runtime.Register("enumerate", "([Ljava/lang/Thread;)I", "")]
public static int Enumerate (Java.Lang.Thread[]? tarray);
[<Android.Runtime.Register("enumerate", "([Ljava/lang/Thread;)I", "")>]
static member Enumerate : Java.Lang.Thread[] -> int

Parameters

tarray
Thread[]

an array into which to put the list of threads

Returns

the number of threads put into the array

Attributes

Remarks

Copies into the specified array every active thread in the current thread's thread group and its subgroups. This method simply invokes the java.lang.ThreadGroup#enumerate(Thread[]) method of the current thread's thread group.

An application might use the #activeCount activeCount method to get an estimate of how big the array should be, however if the array is too short to hold all the threads, the extra threads are silently ignored. If it is critical to obtain every active thread in the current thread's thread group and its subgroups, the invoker should verify that the returned int value is strictly less than the length of tarray.

Due to the inherent race condition in this method, it is recommended that the method only be used for debugging and monitoring purposes.

Java documentation for java.lang.Thread.enumerate(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.

Applies to