private void ReplaceCurrentVersion() { OutputContextVersion contextToClose = null; lock (this) { if (_pendingContext != null) { contextToClose = _currentContext; _currentContext = _pendingContext; _pendingContext = null; } } if (contextToClose != null) { contextToClose.Dispose(); } }
public void Dispose() { lock (this) { _continueProcessing = false; if (_currentContext != null && _currentContext.Context != null) { _currentContext.Context.Instance.Interrupt(); } } InputQueue.PulseAll(); if (_thread != null && !_thread.Join(3000)) { Core.LogError($"Failed to stop output thread for {Name}"); } _pendingContext?.Dispose(); _currentContext?.Dispose(); }