/// <summary> /// Disposes all dispatcher resources and remaining tasks. /// </summary> public override void Dispose() { while (true) { lock (taskList) { if (taskList.Count != 0) { currentTask = taskList[0]; taskList.RemoveAt(0); } else { break; } } currentTask.Dispose(); } dataEvent.Close(); dataEvent = null; if (currentDispatcher == this) { currentDispatcher = null; } if (mainDispatcher == this) { mainDispatcher = null; } }