private Tuple <bool, uint, bool, ulong>[] GetClrRuntimeThreads(int runtimeId) { ClrRuntime clrRuntime = runtimesCache[runtimeId]; IList <ClrThread> clrThreads = clrRuntime.Threads; int[] gcThreadIds = clrRuntime.EnumerateGCThreads().ToArray(); Tuple <bool, uint, bool, ulong>[] threads = new Tuple <bool, uint, bool, ulong> [clrThreads.Count]; for (int i = 0; i < clrThreads.Count; i++) { threads[i] = Tuple.Create( gcThreadIds.Contains((int)clrThreads[i].OSThreadId), clrThreads[i].OSThreadId, clrThreads[i].IsFinalizer, clrThreads[i].AppDomain); } return(threads); }
/// <summary> /// Enumerates the OS thread ID of GC threads in the runtime. /// </summary> /// <returns>IEnumerable<System.Int32>.</returns> /// <inheritdoc /> public IEnumerable <int> EnumerateGCThreads() => Runtime.EnumerateGCThreads();