/// <summary> /// Receive an incoming message from the parent Task. /// </summary> /// <param name="cancellationSource">The cancellation token for the data reading operation cancellation</param> /// <returns>The parent Task's message</returns> public T ReceiveFromParent(CancellationTokenSource cancellationSource = null) { T[] data = _parent.GetData(cancellationSource); if (data == null || data.Length != 1) { throw new InvalidOperationException("Cannot receive data from parent node"); } return(data[0]); }
/// <summary> /// Receive an incoming message from the parent Task. /// </summary> /// <returns>The parent Task's message</returns> public T ReceiveFromParent() { T[] data = _parent.GetData(); if (data == null || data.Length != 1) { throw new InvalidOperationException("Cannot receive data from parent node"); } return(data[0]); }
/// <summary> /// Receive a message from the Task represented by the given NodeStruct. /// Removes the NodeStruct from the nodesWithData queue if requested. /// </summary> /// <param name="node">The node to receive from</param> /// <returns>The byte array message from the node</returns> private T[] ReceiveFromNode(NodeStruct <T> node) { var data = node.GetData(); return(data); }