private void _DestroyEngine() { IrbisServerEngine engine = Engine; if (!ReferenceEquals(engine, null)) { engine.CancelProcessing(); Task workTask = WorkTask; if (!ReferenceEquals(workTask, null)) { int count = 0; while (engine.GetWorkerCount() != 0) { if (count > 50) { break; } RequestAdditionalTime(100); workTask.Wait(100); } } engine.Dispose(); } WorkTask = null; Engine = null; }
static void Main(string[] args) { Console.CancelKeyPress += Console_CancelKeyPress; try { Log.ApplyDefaultsForConsoleApplication(); using (Engine = ServerUtility.CreateEngine(args)) { ServerUtility.DumpEngineSettings(Engine); Log.Trace("Entering server main loop"); Engine.MainLoop(); Log.Trace("Leaved server main loop"); } } catch (Exception exception) { Log.TraceException("Program::Main", exception); } Log.Trace("STOP"); }