public void Dispose() { FileFetcher.CancelDownload(); lock (machLock) { PauseAll(); Array.ForEach(machs.Rights, x => x.Dispose()); machs.Clear(); MasterTimeSource.Dispose(); ExternalsManager.Clear(); HostMachine.Dispose(); CurrentLogger.Dispose(); BackendManager.Dispose(); } }
public void Dispose() { FileFetcher.CancelDownload(); lock (machLock) { var toDispose = machs.Rights.ToArray(); //Although a single machine does not have to be paused before its disposal, //disposing multiple entities has to ensure that all are stopped. ExternalsManager.Pause(); Array.ForEach(toDispose, x => x.Pause()); Array.ForEach(toDispose, x => x.Dispose()); machs.Clear(); MasterTimeSource.Dispose(); ExternalsManager.Clear(); HostMachine.Dispose(); CurrentLogger.Dispose(); BackendManager.Dispose(); } }