Mercurial > pub > ImplabNet
view MonoPlay/Program.cs @ 195:ea485487a424 v2
minor changes
author | cin |
---|---|
date | Wed, 04 May 2016 12:28:08 +0300 |
parents | d45bdf510514 |
children | d7cd7a83189a |
line wrap: on
line source
using System; using Implab; using System.Threading.Tasks; using Implab.Formats.JSON; using System.IO; using System.Text.Json; using System.Diagnostics; using Implab.Parallels; using System.Threading; namespace MonoPlay { class MainClass { public static void Main(string[] args) { var pool = new WorkerPool(10); var listerner = new ConsoleTraceListener(); listerner.TraceOutputOptions = TraceOptions.LogicalOperationStack; Trace.Listeners.Add(listerner); Trace.CorrelationManager.StartLogicalOperation("Main"); var d = pool.Invoke(() => { Trace.CorrelationManager.StartLogicalOperation("Worker"); Thread.Sleep(100); Trace.TraceInformation("worker done"); Trace.CorrelationManager.StopLogicalOperation(); }); ThreadPool.QueueUserWorkItem((o) => { Trace.CorrelationManager.StartLogicalOperation("Thread"); Thread.Sleep(100); Trace.TraceInformation("thread done"); Trace.CorrelationManager.StopLogicalOperation(); }); Trace.TraceInformation("main done"); Trace.CorrelationManager.StopLogicalOperation(); d.Join(); } } }