public static CleanupManagerController GetController() { CleanupManagerController controller = new CleanupManagerController(); if (Interlocked.CompareExchange <CleanupManagerController>(ref CleanupManager.controller, controller, null) != null) { controller.Dispose(); throw new InvalidOperationException("The controller has already been retrieved"); } return(controller); }
internal static void NotifyControllerDisposed(CleanupManagerController disposedController) { Interlocked.CompareExchange <CleanupManagerController>(ref controller, null, disposedController); }