Mercurial > pub > ImplabNet
comparison MonoPlay/Program.cs @ 156:97fbbf816844 v2
Promises: SignalXXX methods merged into SignalHandler method.
Components: RunnableComponent In progress
author | cin |
---|---|
date | Mon, 15 Feb 2016 04:22:15 +0300 |
parents | ec91a6dfa5b3 |
children | 4f82e0f161c3 |
comparison
equal
deleted
inserted
replaced
155:037df317f126 | 156:97fbbf816844 |
---|---|
1 using System; | 1 using System; |
2 using Implab.Diagnostics; | |
3 using Implab.Parallels; | |
4 using Implab; | 2 using Implab; |
5 using System.Collections.Generic; | |
6 using System.Collections.Concurrent; | |
7 using System.Threading; | |
8 using Implab.JSON; | |
9 using System.IO; | |
10 using System.Threading.Tasks; | 3 using System.Threading.Tasks; |
11 | 4 |
12 namespace MonoPlay { | 5 namespace MonoPlay { |
13 class MainClass { | 6 class MainClass { |
14 | 7 |
25 Console.WriteLine("done: {0} ms, {1:.00} Mb, {2} GC", t2 - t1, GC.GetTotalMemory(false) / (1024*1024), GC.CollectionCount(0) ); | 18 Console.WriteLine("done: {0} ms, {1:.00} Mb, {2} GC", t2 - t1, GC.GetTotalMemory(false) / (1024*1024), GC.CollectionCount(0) ); |
26 | 19 |
27 } | 20 } |
28 | 21 |
29 static IPromise<int> DoItem(int x) { | 22 static IPromise<int> DoItem(int x) { |
30 return Promise<int>.FromResult(x + 1); | 23 //return Promise<int>.FromResult(x + 1); |
24 var p = new Promise<int>(); | |
25 p.Resolve(x+1); | |
26 return p; | |
31 } | 27 } |
32 | 28 |
33 static async Task<int> DoWork() { | 29 static async Task<int> DoWork() { |
34 var c = 0; | 30 var c = 0; |
35 for (int i = 0; i < 10000000; i++) | 31 for (int i = 0; i < 10000000; i++) |