Created
January 12, 2012 07:05
-
-
Save sdether/1599137 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Producer { | |
| public static IEnumerator Coroutine(int[,] source, Coordinator<int[]> coordinator) { | |
| Console.WriteLine("producer started"); | |
| for(var i = 0; i < source.GetLength(0); i++) { | |
| coordinator.State = new int[source.GetLength(1)]; | |
| for(var j = 0; j < source.GetLength(1); j++) { | |
| coordinator.State[j] = source[i, j]; | |
| Console.WriteLine("read {0} from [{1},{2}]", source[i, j], i, j); | |
| } | |
| Console.WriteLine("yielding to consumer"); | |
| yield return null; | |
| } | |
| coordinator.State = new int[0]; | |
| Console.WriteLine("producer finished"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment