public JoinBlock(GroupingDataflowBlockOptions dataflowBlockOptions) { if (dataflowBlockOptions == null) { throw new ArgumentNullException("dataflowBlockOptions"); } this.dataflowBlockOptions = dataflowBlockOptions; this.compHelper = new CompletionHelper(dataflowBlockOptions); target1 = new JoinTarget <T1> (this, SignalArrivalTarget, compHelper, () => outgoing.IsCompleted, dataflowBlockOptions, dataflowBlockOptions.Greedy, TryAdd1); target2 = new JoinTarget <T2> (this, SignalArrivalTarget, compHelper, () => outgoing.IsCompleted, dataflowBlockOptions, dataflowBlockOptions.Greedy, TryAdd2); target3 = new JoinTarget <T3> (this, SignalArrivalTarget, compHelper, () => outgoing.IsCompleted, dataflowBlockOptions, dataflowBlockOptions.Greedy, TryAdd3); outgoing = new OutgoingQueue <Tuple <T1, T2, T3> > ( this, compHelper, () => target1.Buffer.IsCompleted || target2.Buffer.IsCompleted || target3.Buffer.IsCompleted, _ => { target1.DecreaseCount(); target2.DecreaseCount(); target3.DecreaseCount(); }, dataflowBlockOptions); }
public JoinBlock(GroupingDataflowBlockOptions dataflowBlockOptions) { if (dataflowBlockOptions == null) { throw new ArgumentNullException("dataflowBlockOptions"); } this.dataflowBlockOptions = dataflowBlockOptions; this.target1 = new JoinTarget <T1> (this, SignalArrivalTarget1, new BlockingCollection <T1> (), compHelper); this.target2 = new JoinTarget <T2> (this, SignalArrivalTarget2, new BlockingCollection <T2> (), compHelper); this.outgoing = new MessageOutgoingQueue <Tuple <T1, T2> > (compHelper, () => target1.Buffer.IsCompleted || target2.Buffer.IsCompleted); }
public BatchedJoinBlock(int batchSize, GroupingDataflowBlockOptions dataflowBlockOptions) { if (batchSize <= 0) { throw new ArgumentOutOfRangeException( "batchSize", batchSize, "The batchSize must be positive."); } if (dataflowBlockOptions == null) { throw new ArgumentNullException("dataflowBlockOptions"); } if (!dataflowBlockOptions.Greedy) { throw new ArgumentException( "Greedy must be true for this dataflow block.", "dataflowBlockOptions"); } if (dataflowBlockOptions.BoundedCapacity != DataflowBlockOptions.Unbounded) { throw new ArgumentException( "BoundedCapacity must be Unbounded or -1 for this dataflow block.", "dataflowBlockOptions"); } BatchSize = batchSize; options = dataflowBlockOptions; completionHelper = CompletionHelper.GetNew(options); target1 = new JoinTarget <T1> ( this, SignalTarget, completionHelper, () => outgoing.IsCompleted, dataflowBlockOptions, true, TryAdd); target2 = new JoinTarget <T2> ( this, SignalTarget, completionHelper, () => outgoing.IsCompleted, dataflowBlockOptions, true, TryAdd); target3 = new JoinTarget <T3> ( this, SignalTarget, completionHelper, () => outgoing.IsCompleted, dataflowBlockOptions, true, TryAdd); outgoing = new OutgoingQueue <Tuple <IList <T1>, IList <T2>, IList <T3> > > ( this, completionHelper, () => target1.Buffer.IsCompleted || target2.Buffer.IsCompleted || target3.Buffer.IsCompleted, _ => { target1.DecreaseCount(); target2.DecreaseCount(); target3.DecreaseCount(); }, options); }
public JoinBlock(GroupingDataflowBlockOptions dataflowBlockOptions) { if (dataflowBlockOptions == null) { throw new ArgumentNullException("dataflowBlockOptions"); } this.dataflowBlockOptions = dataflowBlockOptions; Func <bool> checker1 = () => target2.Buffer.Count == 0 || target3.Buffer.Count == 0; Func <bool> checker2 = () => target1.Buffer.Count == 0 || target3.Buffer.Count == 0; Func <bool> checker3 = () => target1.Buffer.Count == 0 || target2.Buffer.Count == 0; this.target1 = new JoinTarget <T1> (this, () => SignalArrivalTargetImpl(checker1), new BlockingCollection <T1> (), compHelper); this.target2 = new JoinTarget <T2> (this, () => SignalArrivalTargetImpl(checker2), new BlockingCollection <T2> (), compHelper); this.target3 = new JoinTarget <T3> (this, () => SignalArrivalTargetImpl(checker3), new BlockingCollection <T3> (), compHelper); this.outgoing = new MessageOutgoingQueue <Tuple <T1, T2, T3> > (compHelper, () => target1.Buffer.IsCompleted || target2.Buffer.IsCompleted || target3.Buffer.IsCompleted); }