public BroadcastBlock(Func <T, T> cloningFunction, DataflowBlockOptions dataflowBlockOptions) { if (dataflowBlockOptions == null) { throw new ArgumentNullException("dataflowBlockOptions"); } this.cloningFunction = cloningFunction; this.dataflowBlockOptions = dataflowBlockOptions; this.compHelper = new CompletionHelper(dataflowBlockOptions); this.messageBox = new PassingMessageBox <T> (this, messageQueue, compHelper, () => outgoing.IsCompleted, _ => BroadcastProcess(), dataflowBlockOptions); this.outgoing = new BroadcastOutgoingQueue <T> (this, compHelper, () => messageQueue.IsCompleted, messageBox.DecreaseCount, dataflowBlockOptions, cloningFunction != null); }
public WriteOnceBlock(Func <T, T> cloningFunction, DataflowBlockOptions dataflowBlockOptions) { if (dataflowBlockOptions == null) { throw new ArgumentNullException("dataflowBlockOptions"); } this.cloningFunction = cloningFunction; this.dataflowBlockOptions = dataflowBlockOptions; this.compHelper = CompletionHelper.GetNew(dataflowBlockOptions); this.messageBox = new PassingMessageBox <T> (this, messageQueue, compHelper, () => true, _ => BroadcastProcess(), dataflowBlockOptions, canAccept: () => written.TrySet()); this.outgoing = new BroadcastOutgoingQueue <T> (this, compHelper, () => messageQueue.IsCompleted, messageBox.DecreaseCount, dataflowBlockOptions, cloningFunction != null); }