Created
October 5, 2012 17:33
-
-
Save ElemarJR/3841189 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
| static void Main(string[] args) | |
| { | |
| Console.Title = "TPL Dataflow"; | |
| var source = new[] { | |
| "elemarjr", "leandronet", "vquaiato", | |
| "juanplopes", "rodrigovidal", "cleytonferrari", | |
| "diogodamiani", "sricanesh", "rodrigokono" | |
| }; | |
| var ab = new ActionBlock<string>(async s => | |
| { | |
| await Task.Delay(200); | |
| Console.WriteLine(s); | |
| }); | |
| foreach (var item in source) | |
| ab.Post(item); | |
| Console.WriteLine("Data Queued: {0}", ab.InputCount); | |
| while (ab.InputCount > 0) { } | |
| Console.WriteLine("Data Queued: {0}", ab.InputCount); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment