annotate MonoPlay/Program.cs @ 200:71e543dbe65a v2

working version of the project
author cin
date Fri, 14 Oct 2016 04:03:10 +0300
parents d45bdf510514
children d7cd7a83189a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
93
dc4942d09e74 improved tracing
cin
parents:
diff changeset
1 using System;
dc4942d09e74 improved tracing
cin
parents:
diff changeset
2 using Implab;
151
ec91a6dfa5b3 Added support for 'await' operator to promises
cin
parents: 150
diff changeset
3 using System.Threading.Tasks;
183
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
4 using Implab.Formats.JSON;
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
5 using System.IO;
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
6 using System.Text.Json;
194
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
7 using System.Diagnostics;
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
8 using Implab.Parallels;
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
9 using System.Threading;
93
dc4942d09e74 improved tracing
cin
parents:
diff changeset
10
dc4942d09e74 improved tracing
cin
parents:
diff changeset
11 namespace MonoPlay {
dc4942d09e74 improved tracing
cin
parents:
diff changeset
12 class MainClass {
145
706fccb85524 RC: cancellation support for promises + tests
cin
parents: 138
diff changeset
13
706fccb85524 RC: cancellation support for promises + tests
cin
parents: 138
diff changeset
14
93
dc4942d09e74 improved tracing
cin
parents:
diff changeset
15 public static void Main(string[] args) {
194
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
16 var pool = new WorkerPool(10);
150
3258399cba83 JSONWriter improvements
cin
parents: 145
diff changeset
17
194
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
18 var listerner = new ConsoleTraceListener();
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
19 listerner.TraceOutputOptions = TraceOptions.LogicalOperationStack;
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
20 Trace.Listeners.Add(listerner);
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
21
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
22 Trace.CorrelationManager.StartLogicalOperation("Main");
93
dc4942d09e74 improved tracing
cin
parents:
diff changeset
23
194
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
24 var d = pool.Invoke(() => {
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
25 Trace.CorrelationManager.StartLogicalOperation("Worker");
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
26 Thread.Sleep(100);
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
27 Trace.TraceInformation("worker done");
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
28 Trace.CorrelationManager.StopLogicalOperation();
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
29 });
136
e9e7940c7d98 shared locks + tests
cin
parents: 125
diff changeset
30
194
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
31 ThreadPool.QueueUserWorkItem((o) => {
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
32 Trace.CorrelationManager.StartLogicalOperation("Thread");
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
33 Thread.Sleep(100);
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
34 Trace.TraceInformation("thread done");
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
35 Trace.CorrelationManager.StopLogicalOperation();
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
36 });
150
3258399cba83 JSONWriter improvements
cin
parents: 145
diff changeset
37
194
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
38 Trace.TraceInformation("main done");
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
39 Trace.CorrelationManager.StopLogicalOperation();
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
40
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
41 d.Join();
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
42
183
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
43
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
44
145
706fccb85524 RC: cancellation support for promises + tests
cin
parents: 138
diff changeset
45 }
136
e9e7940c7d98 shared locks + tests
cin
parents: 125
diff changeset
46
93
dc4942d09e74 improved tracing
cin
parents:
diff changeset
47 }
dc4942d09e74 improved tracing
cin
parents:
diff changeset
48 }