public void Release() { if (taskManager != null) { taskManager.Release(); taskManager = null; hosts.Clear(); } }
public void ReleaseSharedTaskManager(ITaskManager itaskManager) { if (itaskManager == null) { return; } if (!(itaskManager is TaskManager)) { return; } TaskManager taskManager = (TaskManager)itaskManager; if (sharedTaskManagers.Contains(taskManager)) { Interlocked.Decrement(ref taskManager.sharedCount); if (taskManager.sharedCount == 0) { taskManager.Release(); sharedTaskManagers.Remove(taskManager); } } }