private Task RegisterCompletion(PipelineCallbackType callbackType) { CompletionEntry entry = new(callbackType); lock (_entries) { _entries.Add(entry); } return(entry.CompletionTask); }
private void NotifyCompletions(PipelineCallbackType callbackType) { List <CompletionEntry> matchingEntries; lock (_entries) { matchingEntries = new(_entries.Count); for (int i = 0; i < _entries.Count; i++) { CompletionEntry entry = _entries[i]; if (_entries[i].CallbackType == callbackType) { _entries.RemoveAt(i); matchingEntries.Add(entry); i--; } } } foreach (CompletionEntry entry in matchingEntries) { entry.Complete(); } }
public CompletionEntry(PipelineCallbackType callbackType) { CallbackType = callbackType; }