/// <summary> /// Releases any important resources assocated with the instance. /// </summary> /// <param name="disposing"><c>true</c> if the instance is being disposed as opposed to being finalized.</param> protected void Dispose(bool disposing) { lock (syncLock) { if (outbox != null) { outbox.Close(); outbox = null; } if (inbox != null) { inbox.Close(); inbox = null; } if (disposing) { GC.SuppressFinalize(this); } } }
/// <summary> /// Releases any important resources assocated with the instance. /// </summary> /// <param name="disposing"><c>true</c> if the instance is being disposed as opposed to being finalized.</param> protected void Dispose(bool disposing) { lock (syncLock) { if (outbox != null) { outbox.Close(); outbox = null; } if (inbox != null) { inbox.Close(); inbox = null; } if (timeoutTask != null) { timeoutCts.Cancel(); try { timeoutTask.Wait(TimeSpan.FromSeconds(1)); } catch (TimeoutException) { // Ignore these. } timeoutTask = null; } if (disposing) { GC.SuppressFinalize(this); } } }