public async Task ToInputAsync(IAsyncVertexInputEndpoint endpoint, string otherVertex, string otherEndpoint, CancellationToken token) { Console.WriteLine("Sending data to fused vertex: " + otherVertex + ", endpoint: " + otherEndpoint); MyAsyncFusableInput otherInstance = endpoint as MyAsyncFusableInput; for (int i = 0; i < int.MaxValue; i += 1) { for (int j = 0; j < 1; j++) { otherInstance.WriteInt32(i + j); Console.WriteLine("Written value: " + (i + j)); } for (int j = 0; j < 1; j++) { Thread.Sleep(1000); token.ThrowIfCancellationRequested(); } if (!_running) { break; } } }
/// <summary> /// Vertex implementor uses this to add async input endpoint /// </summary> /// <param name="key"></param> /// <param name="input"></param> protected virtual void AddAsyncInputEndpoint(string key, IAsyncVertexInputEndpoint input) { lock (this) { onAddAsyncInputEndpoint(key, input); } }
public bool CanFuseWith(IAsyncVertexInputEndpoint endpoint, string otherVertex, string otherEndpoint) { if (endpoint as MyAsyncFusableInput != null) { return(true); } return(false); }
public async Task ToInputAsync(IAsyncVertexInputEndpoint inputEndpoint, string otherVertex, string otherEndpoint, CancellationToken token) { _inputEndpoint = inputEndpoint as OperatorFusableInput; bool isAdded = await _inputEndpoint.AddOperatorFusableInput(); if (isAdded) { IEndpointContent endpointContent = new ObjectEndpoint(); ((ObjectEndpoint)endpointContent).SetOperatorOutputEndpoint(this); _operator.AddOutput(_thisId, ref endpointContent); _operator.WaitForOutputCompletion(_thisId); } }