public void Dispose() { #if !CONTRACTS_ONLY if (!_IsDisposed) { #if SUPPORTS_APPDOMAIN AppDomain.CurrentDomain.DomainUnload -= CurrentDomain_DomainUnload; AppDomain.CurrentDomain.UnhandledException -= CurrentDomain_UnhandledException; AppDomain.CurrentDomain.ProcessExit -= CurrentDomain_ProcessExit; #endif _IsDisposed = true; _BufferTimeoutTimer?.Dispose(); _WriteBufferedEventsSignal?.Set(); WaitForBackgroundThreadToExit(); (_LogWriter as IDisposable)?.Dispose(); _WriteBufferedEventsSignal?.Dispose(); var emptySignal = _QueueEmptySignal; _QueueEmptySignal = null; emptySignal?.Dispose(); _LogEventPool?.Dispose(); } #endif }
protected virtual void Dispose(bool isDisposing) { if (isDisposing) { (_LogWriter as IDisposable)?.Dispose(); _EntryPool?.Dispose(); _JobPool?.Dispose(); } }