private static int CleanUp() { var completeRemovals = new List <AmbivalentPipelineReference>(); var keys = TotalWeakKeys; foreach (var entry in Dependencies) { if (entry.Key.IsAlive) { keys -= RemoveNonExisting(entry.Value); } else { completeRemovals.Add(entry.Key); keys -= entry.Value.Count; } } foreach (var keyToRemove in completeRemovals) { Dependencies.Remove(keyToRemove); } OperationsSinceLastCleanup = 0; var removals = TotalWeakKeys - keys; TotalWeakKeys = keys; PotentialStagesForUpdate.RemoveWhere(reference => !reference.IsAlive); return(removals); }
private static void InvalidatePipeline(IEnumerable <IPipelineStage> stages) { var propagation = new PipelinePropagation(stages, Dependencies); lock (Dependencies) { propagation.BuildPropagationTopology(stages, PipelineVersion); propagation.CheckForConcurrentPropagation(PotentialStagesForUpdate); } try { propagation.Propagate(stages); } finally { lock (Dependencies) { PotentialStagesForUpdate.ExceptWith(propagation.StagesThisPropagation); IncrementOperation(); } } }