public void Run() { Log.Info("Starting infinite loop"); try { conf = new SystemConfig(); MessagingInterfaces.UIComm.Init(); // Init static class AnalyzeRunningProcesses(); processMonitorCallback = new processMonitorCallbackDelegate(ProcessMonitorCallback); // Start thread that communites with our server beacon = new Beacon(); beaconThread = new Thread(new ThreadStart(beacon.Run)); beaconThread.Name = "BeaconThread"; beaconThread.IsBackground = true; beaconThread.Start(); while (QdMonitor(processMonitorCallback)) { if (!bRunning) { return; // Using return instead of break so I can detect failures } } Log.Info("Broke out of QdMonitor loop. This should not happen."); } catch (Exception e) { Log.Exception(e, "Exception in Service.Run"); // This is really bad, so rethrow the exception so we exit throw e; } }
public static extern Boolean QdMonitor(processMonitorCallbackDelegate cb);