예제 #1
0
 void VerifyCompleteness()
 {
     if (outgoing.IsCompleted && externalCompleteTester())
     {
         compHelper.Complete();
     }
 }
예제 #2
0
        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();
                }
            });
        }
예제 #3
0
 void VerifyCompleteness()
 {
     if (messageQueue.IsCompleted && externalCompleteTester())
     {
         compHelper.Complete();
     }
 }
예제 #4
0
 public void Complete()
 {
     compHelper.Complete();
     source.Complete();
     target.Complete();
 }