Program.cs
48 lines
| 1.3 KiB
| text/x-csharp
|
CSharpLexer
/ MonoPlay / Program.cs
cin
|
r93 | using System; | ||
using Implab; | ||||
cin
|
r151 | using System.Threading.Tasks; | ||
cin
|
r183 | using Implab.Formats.JSON; | ||
using System.IO; | ||||
using System.Text.Json; | ||||
cin
|
r194 | using System.Diagnostics; | ||
using Implab.Parallels; | ||||
using System.Threading; | ||||
cin
|
r93 | |||
namespace MonoPlay { | ||||
class MainClass { | ||||
cin
|
r145 | |||
cin
|
r93 | public static void Main(string[] args) { | ||
cin
|
r194 | var pool = new WorkerPool(10); | ||
cin
|
r150 | |||
cin
|
r194 | var listerner = new ConsoleTraceListener(); | ||
listerner.TraceOutputOptions = TraceOptions.LogicalOperationStack; | ||||
Trace.Listeners.Add(listerner); | ||||
Trace.CorrelationManager.StartLogicalOperation("Main"); | ||||
cin
|
r93 | |||
cin
|
r194 | var d = pool.Invoke(() => { | ||
Trace.CorrelationManager.StartLogicalOperation("Worker"); | ||||
Thread.Sleep(100); | ||||
Trace.TraceInformation("worker done"); | ||||
Trace.CorrelationManager.StopLogicalOperation(); | ||||
}); | ||||
cin
|
r136 | |||
cin
|
r194 | ThreadPool.QueueUserWorkItem((o) => { | ||
Trace.CorrelationManager.StartLogicalOperation("Thread"); | ||||
Thread.Sleep(100); | ||||
Trace.TraceInformation("thread done"); | ||||
Trace.CorrelationManager.StopLogicalOperation(); | ||||
}); | ||||
cin
|
r150 | |||
cin
|
r194 | Trace.TraceInformation("main done"); | ||
Trace.CorrelationManager.StopLogicalOperation(); | ||||
d.Join(); | ||||
cin
|
r183 | |||
cin
|
r145 | } | ||
cin
|
r136 | |||
cin
|
r93 | } | ||
} | ||||