private void MogProcess() { // Loop until we shutdown while (!MOG_Main.IsShutdown()) { // Only process while we are not shutting down? if (!MOG_Main.IsShutdownInProgress()) { try { MOG_Main.Process(); } catch (Exception ex) { MOG_Report.ReportSilent("MogProcess", ex.Message, ex.StackTrace, MOG_ALERT_LEVEL.CRITICAL); } } Thread.Sleep(1); } // Inform our parent thread that we have exited mMogProcess = null; // Gracefully wait a while to see if our parent thread will terminate the application for us? Thread.Sleep(500); // At this point, let's take the inititive and shut ourselves down Application.Exit(); }