public ProcessMonitor(Dictionary <string, Thread> threadList, Dictionary <string, Timer> timers) : base("processes", "lists and manages threads and timers") { _threads = threadList; _timers = timers; _default = ListAll; List <Thread> removalQ = new List <Thread>(); init = () => { //Start Thread Monitor Karuta.StartTimer("ThreadMonitor", e => { removalQ.Clear(); removalQ.AddRange(from thread in _threads.Values where thread.ThreadState == ThreadState.Aborted || thread.ThreadState == ThreadState.Stopped select thread); foreach (Thread thread in removalQ) { Karuta.LOGGER.Log($"Thread \"{thread.Name}\" has been {thread.ThreadState} and will be removed", appName); Karuta.CloseThread(thread); } }, 5 * 1000, 5 * 1000); }; }