Mercurial > pub > ImplabNet
annotate Implab/Diagnostics/Extensions.cs @ 137:238e15580926 v2
added the blocking queue
author | cin |
---|---|
date | Mon, 16 Feb 2015 17:48:39 +0300 |
parents | 04d4c92d0f28 |
children | f75cfa58e3d4 |
rev | line source |
---|---|
134 | 1 namespace Implab.Diagnostics { |
92 | 2 public static class Extensions { |
3 public static IPromise<T> EndLogicalOperation<T>(this IPromise<T> promise) { | |
4 Safe.ArgumentNotNull(promise, "promise"); | |
5 var op = TraceContext.Instance.DetachLogicalOperation(); | |
6 | |
119
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
109
diff
changeset
|
7 return promise.On( |
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
109
diff
changeset
|
8 x => { |
109 | 9 TraceContext.Instance.EnterLogicalOperation(op,true); |
10 TraceLog.TraceInformation("promise = {0}", x); | |
11 TraceLog.EndLogicalOperation(); | |
12 TraceContext.Instance.Leave(); | |
13 }, | |
14 err =>{ | |
15 TraceContext.Instance.EnterLogicalOperation(op,true); | |
16 TraceLog.TraceError("promise died {0}", err); | |
17 TraceLog.EndLogicalOperation(); | |
18 TraceContext.Instance.Leave(); | |
19 }, | |
20 () => { | |
21 TraceContext.Instance.EnterLogicalOperation(op,true); | |
22 TraceLog.TraceInformation("promise cancelled"); | |
23 TraceLog.EndLogicalOperation(); | |
24 TraceContext.Instance.Leave(); | |
25 } | |
26 ); | |
92 | 27 } |
94 | 28 |
29 public static IPromise EndLogicalOperation(this IPromise promise) { | |
30 Safe.ArgumentNotNull(promise, "promise"); | |
31 var op = TraceContext.Instance.DetachLogicalOperation(); | |
32 | |
119
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
109
diff
changeset
|
33 return promise.On(() => { |
94 | 34 TraceContext.Instance.EnterLogicalOperation(op,true); |
35 TraceLog.EndLogicalOperation(); | |
36 TraceContext.Instance.Leave(); | |
119
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
109
diff
changeset
|
37 }, PromiseEventType.All); |
94 | 38 } |
92 | 39 } |
40 } | |
41 |