private static async Task <string> SecondCoroutine( Coordinator <string> coordinator, string initialValue) { Console.WriteLine(" Starting SecondCoroutine with initial value {0}", initialValue); Console.WriteLine(" Starting SecondCoroutine"); Console.WriteLine(" Yielding 'y1' from SecondCoroutine..."); string received = await coordinator.Yield("y1"); Console.WriteLine(" Returned to SecondCoroutine with value {0}", received); Console.WriteLine(" Yielding 'y2' from SecondCoroutine..."); received = await coordinator.Yield("y2"); Console.WriteLine(" Returned to SecondCoroutine with value {0}", received); // FirstCoroutine has finished now - so we'll get y3 back to ourselves Console.WriteLine(" Yielding 'y3' from SecondCoroutine..."); received = await coordinator.Yield("y3"); Console.WriteLine(" Returned to SecondCoroutine with value {0}", received); Console.WriteLine(" Finished SecondCoroutine"); return("y4"); }
private static async Task<string> SecondCoroutine( Coordinator<string> coordinator, string initialValue) { Console.WriteLine(" Starting SecondCoroutine with initial value {0}", initialValue); Console.WriteLine(" Starting SecondCoroutine"); Console.WriteLine(" Yielding 'y1' from SecondCoroutine..."); string received = await coordinator.Yield("y1"); Console.WriteLine(" Returned to SecondCoroutine with value {0}", received); Console.WriteLine(" Yielding 'y2' from SecondCoroutine..."); received = await coordinator.Yield("y2"); Console.WriteLine(" Returned to SecondCoroutine with value {0}", received); // FirstCoroutine has finished now - so we'll get y3 back to ourselves Console.WriteLine(" Yielding 'y3' from SecondCoroutine..."); received = await coordinator.Yield("y3"); Console.WriteLine(" Returned to SecondCoroutine with value {0}", received); Console.WriteLine(" Finished SecondCoroutine"); return "y4"; }
private static async Task <string> FirstCoroutine( Coordinator <string> coordinator, string initialValue) { Console.WriteLine("Starting FirstCoroutine with initial value {0}", initialValue); Console.WriteLine("Yielding 'x1' from FirstCoroutine..."); string received = await coordinator.Yield("x1"); Console.WriteLine("Returned to FirstCoroutine with value {0}", received); Console.WriteLine("Yielding 'x2' from FirstCoroutine..."); received = await coordinator.Yield("x2"); Console.WriteLine("Returned to FirstCoroutine with value {0}", received); Console.WriteLine("Finished FirstCoroutine"); return("x3"); }
private static async Task<string> FirstCoroutine( Coordinator<string> coordinator, string initialValue) { Console.WriteLine("Starting FirstCoroutine with initial value {0}", initialValue); Console.WriteLine("Yielding 'x1' from FirstCoroutine..."); string received = await coordinator.Yield("x1"); Console.WriteLine("Returned to FirstCoroutine with value {0}", received); Console.WriteLine("Yielding 'x2' from FirstCoroutine..."); received = await coordinator.Yield("x2"); Console.WriteLine("Returned to FirstCoroutine with value {0}", received); Console.WriteLine("Finished FirstCoroutine"); return "x3"; }
private static async Task <string> ThirdCoroutine( Coordinator <string> coordinator, string initialValue) { Console.WriteLine(" Starting ThirdCoroutine with initial value {0}", initialValue); Console.WriteLine(" Yielding 'z1' from ThirdCoroutine..."); string received = await coordinator.Yield("z1"); Console.WriteLine(" Returned to ThirdCoroutine with value {0}", received); Console.WriteLine(" Finished ThirdCoroutine..."); return("z2"); }
private static async Task<string> ThirdCoroutine( Coordinator<string> coordinator, string initialValue) { Console.WriteLine(" Starting ThirdCoroutine with initial value {0}", initialValue); Console.WriteLine(" Yielding 'z1' from ThirdCoroutine..."); string received = await coordinator.Yield("z1"); Console.WriteLine(" Returned to ThirdCoroutine with value {0}", received); Console.WriteLine(" Finished ThirdCoroutine..."); return "z2"; }