Auto status change to "Under Review"
@@ -1,48 +1,45 | |||
|
1 |
using |
|
|
2 | using Implab; | |
|
3 | using System.Threading.Tasks; | |
|
4 | using Implab.Formats.JSON; | |
|
5 | using System.IO; | |
|
6 | using System.Text.Json; | |
|
7 | using System.Diagnostics; | |
|
1 | using Implab; | |
|
8 | 2 | using Implab.Parallels; |
|
3 | using Implab.Diagnostics; | |
|
9 | 4 | using System.Threading; |
|
10 | 5 | |
|
11 | 6 | namespace MonoPlay { |
|
12 | 7 | class MainClass { |
|
13 | 8 | |
|
14 | 9 | |
|
15 | 10 | public static void Main(string[] args) { |
|
16 | 11 | var pool = new WorkerPool(10); |
|
17 | 12 | |
|
18 | 13 | var listerner = new ConsoleTraceListener(); |
|
19 | listerner.TraceOutputOptions = TraceOptions.LogicalOperationStack; | |
|
20 | Trace.Listeners.Add(listerner); | |
|
14 | listerner.Subscribe<TraceEvent>(); | |
|
21 | 15 | |
|
22 |
Trace |
|
|
16 | TraceLog.StartLogicalOperation("Main"); | |
|
17 | ||
|
23 | 18 | |
|
24 | 19 | var d = pool.Invoke(() => { |
|
25 |
Trace |
|
|
20 | TraceLog.StartLogicalOperation("Worker"); | |
|
26 | 21 | Thread.Sleep(100); |
|
27 | Trace.TraceInformation("worker done"); | |
|
28 |
Trace. |
|
|
22 | TraceLog.TraceInformation("worker done"); | |
|
23 | TraceLog.EndLogicalOperation(); | |
|
29 | 24 | }); |
|
30 | 25 | |
|
26 | var op = TraceContext.Instance.CurrentOperation; | |
|
31 | 27 | ThreadPool.QueueUserWorkItem((o) => { |
|
32 |
Trace. |
|
|
28 | TraceContext.Instance.EnterLogicalOperation(op, false); | |
|
29 | TraceLog.StartLogicalOperation("Thread"); | |
|
33 | 30 | Thread.Sleep(100); |
|
34 | Trace.TraceInformation("thread done"); | |
|
35 |
Trace. |
|
|
31 | TraceLog.TraceInformation("thread done"); | |
|
32 | TraceLog.EndLogicalOperation(); | |
|
36 | 33 | }); |
|
37 | 34 | |
|
38 | Trace.TraceInformation("main done"); | |
|
39 |
Trace. |
|
|
35 | TraceLog.TraceInformation("main done"); | |
|
36 | TraceLog.EndLogicalOperation(); | |
|
40 | 37 | |
|
41 | 38 | d.Join(); |
|
42 | 39 | |
|
43 | 40 | |
|
44 | 41 | |
|
45 | 42 | } |
|
46 | 43 | |
|
47 | 44 | } |
|
48 | 45 | } |
General Comments 3
ok, latest stable version should be in default
You need to be logged in to leave comments.
Login now