##// END OF EJS Templates
working on diagnostics
working on diagnostics

File last commit:

r194:d45bdf510514 v2
r194:d45bdf510514 v2
Show More
Program.cs
48 lines | 1.3 KiB | text/x-csharp | CSharpLexer
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();
}
}
}