annotate Implab/Diagnostics/Extensions.cs @ 97:b11c7e9d93bc v2

added enumerable interface to MTQueue
author cin
date Fri, 31 Oct 2014 17:34:54 +0300
parents a43745f81f10
children 1b7ebcc52e5a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
92
4c0e5ef99986 rewritten tracing
cin
parents:
diff changeset
1 namespace Implab.Diagnostics {
4c0e5ef99986 rewritten tracing
cin
parents:
diff changeset
2 public static class Extensions {
4c0e5ef99986 rewritten tracing
cin
parents:
diff changeset
3 public static IPromise<T> EndLogicalOperation<T>(this IPromise<T> promise) {
4c0e5ef99986 rewritten tracing
cin
parents:
diff changeset
4 Safe.ArgumentNotNull(promise, "promise");
4c0e5ef99986 rewritten tracing
cin
parents:
diff changeset
5 var op = TraceContext.Instance.DetachLogicalOperation();
4c0e5ef99986 rewritten tracing
cin
parents:
diff changeset
6
4c0e5ef99986 rewritten tracing
cin
parents:
diff changeset
7 return promise.Anyway(() => {
4c0e5ef99986 rewritten tracing
cin
parents:
diff changeset
8 TraceContext.Instance.EnterLogicalOperation(op,true);
4c0e5ef99986 rewritten tracing
cin
parents:
diff changeset
9 TraceLog.EndLogicalOperation();
4c0e5ef99986 rewritten tracing
cin
parents:
diff changeset
10 TraceContext.Instance.Leave();
4c0e5ef99986 rewritten tracing
cin
parents:
diff changeset
11 });
4c0e5ef99986 rewritten tracing
cin
parents:
diff changeset
12 }
94
a43745f81f10 minor fixes
cin
parents: 92
diff changeset
13
a43745f81f10 minor fixes
cin
parents: 92
diff changeset
14 public static IPromise EndLogicalOperation(this IPromise promise) {
a43745f81f10 minor fixes
cin
parents: 92
diff changeset
15 Safe.ArgumentNotNull(promise, "promise");
a43745f81f10 minor fixes
cin
parents: 92
diff changeset
16 var op = TraceContext.Instance.DetachLogicalOperation();
a43745f81f10 minor fixes
cin
parents: 92
diff changeset
17
a43745f81f10 minor fixes
cin
parents: 92
diff changeset
18 return promise.Anyway(() => {
a43745f81f10 minor fixes
cin
parents: 92
diff changeset
19 TraceContext.Instance.EnterLogicalOperation(op,true);
a43745f81f10 minor fixes
cin
parents: 92
diff changeset
20 TraceLog.EndLogicalOperation();
a43745f81f10 minor fixes
cin
parents: 92
diff changeset
21 TraceContext.Instance.Leave();
a43745f81f10 minor fixes
cin
parents: 92
diff changeset
22 });
a43745f81f10 minor fixes
cin
parents: 92
diff changeset
23 }
92
4c0e5ef99986 rewritten tracing
cin
parents:
diff changeset
24 }
4c0e5ef99986 rewritten tracing
cin
parents:
diff changeset
25 }
4c0e5ef99986 rewritten tracing
cin
parents:
diff changeset
26