void VerifyCompleteness() { if (outgoing.IsCompleted && externalCompleteTester()) { compHelper.Complete(); } }
protected override void EnsureProcessing() { if (!started.TryRelaxedSet()) { return; } Task[] tasks = new Task[dataflowBlockOptions.MaxDegreeOfParallelism]; for (int i = 0; i < tasks.Length; ++i) { tasks[i] = Task.Factory.StartNew(processQueue); } Task.Factory.ContinueWhenAll(tasks, (_) => { started.Value = false; // Re-run ourselves in case of a race when data is available in the end if (messageQueue.Count > 0) { EnsureProcessing(); } else if (messageQueue.IsCompleted) { compHelper.Complete(); } }); }
void VerifyCompleteness() { if (messageQueue.IsCompleted && externalCompleteTester()) { compHelper.Complete(); } }
public void Complete() { compHelper.Complete(); source.Complete(); target.Complete(); }