Skip to content

Instantly share code, notes, and snippets.

@ElemarJR
Created October 5, 2012 17:33
Show Gist options
  • Select an option

  • Save ElemarJR/3841189 to your computer and use it in GitHub Desktop.

Select an option

Save ElemarJR/3841189 to your computer and use it in GitHub Desktop.
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