/// <summary> /// Not expected to be called concurrently with TryAdd(). /// </summary> public void Dispose() { TryFlushAsync().GetAwaiter().GetResult(); workerCancellation.Cancel(); WaitForWorkerCompletion(); SignalFlushWaiters(DrainFlushWaiters(), false); workerCancellation.Dispose(); writerProvider.Dispose(); }
public void Dispose() { if (writerProvider == null) { return; } workerCancellation.Cancel(); lock (sync) { writerProvider.Dispose(); writerProvider = null; workerCancellation.Dispose(); } }