static void Main(string [] args) { var threadObject = new ThreadManger(); List <Thread> listOfThreads = new List <Thread>(); foreach (var process in args) { var monitorObject = new MonitorProcess(process); listOfThreads.Add(new Thread(() => monitorObject.startMonitorProcess(threadObject.getBool()))); } threadObject.setThreadList(listOfThreads); threadObject.StartAllThreads(); }
// On CTOR setting prgoram running // getting ThreadManger since bool can only be copied public GuradBool(ThreadManger threadManger) { this.programRunning = threadManger.getBool(); this.programRunning = true; }