/// <summary> /// Remove the pair with locking. /// </summary> /// <param name="pattern"></param> /// <param name="source"></param> /// <returns></returns> private bool RemovePattern(IEnumerable <TContent> pattern, TaskCompletionSource <IEnumerable <TContent> > source) { pattern_lock.EnterWriteLock(); try { return(Patterns.Remove(pattern, source)); } finally { pattern_lock.ExitWriteLock(); } }
private bool disposedValue = false; // To detect redundant calls /// <summary> /// Dispose this object. /// </summary> /// <param name="disposing"></param> protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { foreach (var p in patterns) { dict.Remove(p, toCall); } } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. disposedValue = true; } }