private static void UseSimple() { var pipeline = TPLDataflowPipelineSimple.CreatePipeline(resultCallback: res => { Console.WriteLine(res); Console.WriteLine(Utils.GetThreadPoolThreadsInUse()); }); for (int i = 0; i < 50; i++) { pipeline.Post("The pipeline pattern is the best pattern"); } }
private static void UseSimpleAsync() { var pipeline = TPLDataflowPipelineSimple.CreatePipeline(resultCallback: res => { Console.WriteLine(res); Console.WriteLine(Utils.GetThreadPoolThreadsInUse()); }); Task.Run(async() => { for (int i = 0; i < 50; i++) { await pipeline.SendAsync("The pipeline pattern is the best pattern"); } }); }