public static void Stop() { if (ReleaseMutex) { AppMutex?.ReleaseMutex(); AppMutex?.Dispose(); } }
/// <summary> /// 应用程序退出之前 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void CurrentDomainProcessExit(object sender, EventArgs e) { //释放远程管理模块 RemoteControlModule.Dispose(); //释放单元管理模块,应确保已无单元正在运行 UnitManageModule.Dispose(); //释放单元日志模块 UnitLoggerModule.Dispose(); //释放单元性能监控模块 UnitPerformanceCounterModule.Dispose(); //是否单元网络监控模块 UnitNetworkCounterModule.Dispose(); //停止服务 if (DaemonServiceController != null) { DaemonServiceController.Stop(); } //释放自身进程引用 AppMutex.Dispose(); AppProcess.Dispose(); //释放日志模块 Helpers.LoggerModuleHelper.TryLog("Program.CurrentDomainProcessExit[Warning]", "服务主机进程退出"); LoggerModule.Dispose(); }
private void Dispose(bool disposing) { AppMutex.Dispose(); }
/// <summary> /// Counterpart to <see cref="MutexAcquire"/>. /// </summary> private void MutexRelease() { _updateMutex?.Dispose(); _legacyUpdateMutex?.Dispose(); }