private static void Shutdown() { object sync = UpdatesService.sync; lock (sync) { if (instance != null) { instance.Dispose(); instance = null; } } }
public static IDisposable Initialize(IUpdatesServiceHost host) { object sync = UpdatesService.sync; lock (sync) { if (instance != null) { ExceptionUtil.ThrowInvalidOperationException("Initialize has already been called"); } instance = new UpdatesService(host); return(Disposable.FromAction(delegate { Shutdown(); }, false)); } }